arch/riscv/kvm/vcpu_sbi_sta.c

Source file repositories/reference/linux-study-clean/arch/riscv/kvm/vcpu_sbi_sta.c

File Facts

System
Linux kernel
Corpus path
arch/riscv/kvm/vcpu_sbi_sta.c
Extension
.c
Size
5611 bytes
Lines
234
Domain
Architecture Layer
Bucket
arch/riscv
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (IS_ENABLED(CONFIG_32BIT)) {
			gpa_t hi = upper_32_bits(vcpu->arch.sta.shmem);

			new_shmem = value;
			new_shmem |= hi << 32;
		} else {
			new_shmem = value;
		}
		break;
	case KVM_REG_RISCV_SBI_STA_REG(shmem_hi):
		if (IS_ENABLED(CONFIG_32BIT)) {
			gpa_t lo = lower_32_bits(vcpu->arch.sta.shmem);

			new_shmem = ((gpa_t)value << 32);
			new_shmem |= lo;
		} else if (value != 0) {
			return -EINVAL;
		}
		break;
	default:
		return -ENOENT;
	}

	if (new_shmem != INVALID_GPA && !IS_ALIGNED(new_shmem, 64))
		return -EINVAL;

	vcpu->arch.sta.shmem = new_shmem;

	return 0;
}

const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_sta = {
	.extid_start = SBI_EXT_STA,
	.extid_end = SBI_EXT_STA,
	.handler = kvm_sbi_ext_sta_handler,
	.probe = kvm_sbi_ext_sta_probe,
	.reset = kvm_riscv_vcpu_sbi_sta_reset,
	.state_reg_subtype = KVM_REG_RISCV_SBI_STA,
	.get_state_reg_count = kvm_sbi_ext_sta_get_state_reg_count,
	.get_state_reg = kvm_sbi_ext_sta_get_reg,
	.set_state_reg = kvm_sbi_ext_sta_set_reg,
};

Annotation

Implementation Notes