/* * A SEV-SNP VM requires the policy reserved bit to always be set. * The SMT policy bit is also required to be set based on SMT being * available and active on the system.
*/ staticinline u64 snp_default_policy(void)
{ return SNP_POLICY_RSVD_MBO | (is_smt_on() ? SNP_POLICY_SMT : 0);
}
/* * The KVM_MEMORY_ENCRYPT_OP uAPI is utter garbage and takes an "unsigned long" * instead of a proper struct. The size of the parameter is embedded in the * ioctl number, i.e. is ABI and thus immutable. Hack around the mess by * creating an overlay to pass in an "unsigned long" without a cast (casting * will make the compiler unhappy due to dereferencing an aliased pointer).
*/ #define __vm_sev_ioctl(vm, cmd, arg) \
({ \ int r; \
\ union { \ struct kvm_sev_cmd c; \ unsignedlong raw; \
} sev_cmd = { .c = { \
.id = (cmd), \
.data = (uint64_t)(arg), \
.sev_fd = (vm)->arch.sev_fd, \
} }; \
\
r = __vm_ioctl(vm, KVM_MEMORY_ENCRYPT_OP, &sev_cmd.raw); \
r ?: sev_cmd.c.error; \
})
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.