Add a riscv_iommu_reset() helper in the base emulation code that implements the expected reset behavior as defined by the riscv-iommu spec. Devices can then use this helper in their own reset callbacks. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20241106133407.604587-7-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * QEMU emulation of an RISC-V IOMMU
 | 
						|
 *
 | 
						|
 * Copyright (C) 2022-2023 Rivos Inc.
 | 
						|
 *
 | 
						|
 * This program is free software; you can redistribute it and/or modify it
 | 
						|
 * under the terms and conditions of the GNU General Public License,
 | 
						|
 * version 2 or later, as published by the Free Software Foundation.
 | 
						|
 *
 | 
						|
 * This program is distributed in the hope that it will be useful,
 | 
						|
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						|
 * GNU General Public License for more details.
 | 
						|
 *
 | 
						|
 * You should have received a copy of the GNU General Public License along
 | 
						|
 * with this program; if not, see <http://www.gnu.org/licenses/>.
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef HW_RISCV_IOMMU_H
 | 
						|
#define HW_RISCV_IOMMU_H
 | 
						|
 | 
						|
#include "qemu/osdep.h"
 | 
						|
#include "qom/object.h"
 | 
						|
 | 
						|
#define TYPE_RISCV_IOMMU "riscv-iommu"
 | 
						|
OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUState, RISCV_IOMMU)
 | 
						|
typedef struct RISCVIOMMUState RISCVIOMMUState;
 | 
						|
 | 
						|
#define TYPE_RISCV_IOMMU_MEMORY_REGION "riscv-iommu-mr"
 | 
						|
typedef struct RISCVIOMMUSpace RISCVIOMMUSpace;
 | 
						|
 | 
						|
#define TYPE_RISCV_IOMMU_PCI "riscv-iommu-pci"
 | 
						|
OBJECT_DECLARE_TYPE(RISCVIOMMUStatePci, RISCVIOMMUPciClass, RISCV_IOMMU_PCI)
 | 
						|
typedef struct RISCVIOMMUStatePci RISCVIOMMUStatePci;
 | 
						|
typedef struct RISCVIOMMUPciClass RISCVIOMMUPciClass;
 | 
						|
 | 
						|
#define TYPE_RISCV_IOMMU_SYS "riscv-iommu-device"
 | 
						|
OBJECT_DECLARE_TYPE(RISCVIOMMUStateSys, RISCVIOMMUSysClass, RISCV_IOMMU_SYS)
 | 
						|
typedef struct RISCVIOMMUStateSys RISCVIOMMUStateSys;
 | 
						|
typedef struct RISCVIOMMUSysClass RISCVIOMMUSysClass;
 | 
						|
 | 
						|
#define FDT_IRQ_TYPE_EDGE_LOW 1
 | 
						|
 | 
						|
#endif
 |