linux/virt/kvm/arm/vgic/vgic-mmio-v2.c
/* These are for userland accesses only, there is no guest-facing emulation. */
These are for userland accesses only, there is no guest-facing emulation.
These are for userland accesses only there is no guest - facing emulation .
static unsigned long vgic_mmio_read_vcpuif(struct kvm_vcpu *vcpu,
					   gpa_t addr, unsigned int len)
{
	struct vgic_vmcr vmcr;
	u32 val;
	vgic_get_vmcr(vcpu, &vmcr);
	switch (addr & 0xff) {
	case GIC_CPU_CTRL:
		val = vmcr.grpen0 << GIC_CPU_CTRL_EnableGrp0_SHIFT;
		val |= vmcr.grpen1 << GIC_CPU_CTRL_EnableGrp1_SHIFT;
		val |= vmcr.ackctl << GIC_CPU_CTRL_AckCtl_SHIFT;
		val |= vmcr.fiqen << GIC_CPU_CTRL_FIQEn_SHIFT;
		val |= vmcr.cbpr << GIC_CPU_CTRL_CBPR_SHIFT;
		val |= vmcr.eoim << GIC_CPU_CTRL_EOImodeNS_SHIFT;
		break;
	case GIC_CPU_PRIMASK:
		val = (vmcr.pmr & GICV_PMR_PRIORITY_MASK) >>
			GICV_PMR_PRIORITY_SHIFT;
		break;
	case GIC_CPU_BINPOINT:
		val = vmcr.bpr;
		break;
	case GIC_CPU_ALIAS_BINPOINT:
		val = vmcr.abpr;
		break;
	case GIC_CPU_IDENT:
		val = ((PRODUCT_ID_KVM << 20) |
		       (GICC_ARCH_VERSION_V2 << 16) |
		       IMPLEMENTER_ARM);
		break;
	default:
		return 0;
	}
	return val;
}
static unsigned long vgic_mmio_read_vcpuif ( struct kvm_vcpu * vcpu , gpa_t addr , unsigned int len ) { struct vgic_vmcr vmcr ; u32 val ; vgic_get_vmcr ( vcpu , & vmcr ) ; switch ( addr & 0xff ) { case GIC_CPU_CTRL : val = vmcr . grpen0 << GIC_CPU_CTRL_EnableGrp0_SHIFT ; val |= vmcr . grpen1 << GIC_CPU_CTRL_EnableGrp1_SHIFT ; val |= vmcr . ackctl << GIC_CPU_CTRL_AckCtl_SHIFT ; val |= vmcr . fiqen << GIC_CPU_CTRL_FIQEn_SHIFT ; val |= vmcr . cbpr << GIC_CPU_CTRL_CBPR_SHIFT ; val |= vmcr . eoim << GIC_CPU_CTRL_EOImodeNS_SHIFT ; break ; case GIC_CPU_PRIMASK : val = ( vmcr . pmr & GICV_PMR_PRIORITY_MASK ) >> GICV_PMR_PRIORITY_SHIFT ; break ; case GIC_CPU_BINPOINT : val = vmcr . bpr ; break ; case GIC_CPU_ALIAS_BINPOINT : val = vmcr . abpr ; break ; case GIC_CPU_IDENT : val = ( ( PRODUCT_ID_KVM << 20 ) | ( GICC_ARCH_VERSION_V2 << 16 ) | IMPLEMENTER_ARM ) ; break ; default : return 0 ; } return val ; }
These are for userland accesses only, there is no guest-facing emulation.
These are for userland accesses only there is no guest - facing emulation .
/*
		 * Our KVM_DEV_TYPE_ARM_VGIC_V2 device ABI exports the
		 * the PMR field as GICH_VMCR.VMPriMask rather than
		 * GICC_PMR.Priority, so we expose the upper five bits of
		 * priority mask to userspace using the lower bits in the
		 * unsigned long.
		 */