Re: [PATCH] x86/sgx: Declare sgx_set_attribute() for !CONFIG_X86_SGX

From: Paolo Bonzini
Date: Mon Sep 06 2021 - 04:35:39 EST


On 03/09/21 17:58, Jarkko Sakkinen wrote:
Eh, it doesn't really simplify the usage. If anything it makes it more convoluted
because the capability check in kvm_vm_ioctl_check_extension() still needs an
#ifdef, e.g. readers will wonder why the check is conditional but the usage is not.
It does objectively a bit, since it's one ifdef less.

But you're effectively replacing #ifdef CONFIG_X86_SGX_KVM with #ifdef CONFIG_X86_SGX; so the patch is not a no-op as far as KVM is concerned.

So NACK for the KVM parts (yeah I know it's RFC but just to be clearer), but I agree that adding a stub inline version of the function is standard practice and we do it a lot in KVM too.

Paolo

This is fairly standard practice to do in kernel APIs, used in countless
places, for instance in Tony's patch set to add MCE recovery for SGX. And
it would be nice to share common pattern here how we define API now and
futre.

I also remarked that declaration of "sgx_provisioning_allowed" is not flagged,
which is IMHO even more convolved because without SGX it is spare data.