Hi Raghavendra, On 4/7/22 9:15 AM, Raghavendra Rao Ananta wrote:
Continuing the discussion from [1], the series tries to add support for the userspace to elect the hypercall services that it wishes to expose to the guest, rather than the guest discovering them unconditionally. The idea employed by the series was taken from [1] as suggested by Marc Z. In a broad sense, the concept is similar to the current implementation of PSCI interface- create a 'firmware psuedo-register' to handle the firmware revisions. The series extends this idea to all the other hypercalls such as TRNG (True Random Number Generator), PV_TIME (Paravirtualized Time), and PTP (Precision Time protocol). For better categorization and future scaling, these firmware registers are categorized based on the service call owners. Also, unlike the existing firmware psuedo-registers, they hold the features supported in the form of a bitmap. During the VM initialization, the registers holds an upper-limit of the features supported by each one of them. It's expected that the userspace discover the features provided by each register via GET_ONE_REG, and writeback the desired values using SET_ONE_REG. KVM allows this modification only until the VM has started. Some of the standard function-ids, such as ARM_SMCCC_VERSION_FUNC_ID, need not be associated with a feature bit. For such ids, the series introduced an allowed-list, hvc_func_default_allowed_list[], that holds all such ids. As a result, the functions that are not elected by userspace, or if they are not a part of this allowed-list, will be denied for when the guests invoke them. Older VMMs can simply ignore this interface and the hypercall services will be exposed unconditionally to the guests, thus ensuring backward compatibility.
[...] I rethinking about the design again and just get one question. Hopefully, someone have the answer for us. The newly added 3 pseudo registers and the existing ones like KVM_REG_ARM_PSCI_VERSION are all tied up with vcpu, instead of VM. I don't think it's correct. I'm not sure if VM-scoped pseudo registers aren't allowed by ARM architecture or the effort isn't worthy to support it. These pseudo registers are introduced to present the available hypercalls, and then they can be disabled from userspace. In the implementation, these 3 registers are vcpu scoped. It means that multiple vcpus can be asymmetric in terms of usable hypercalls. For example, ARM_SMCCC_TRNG hypercalls can be enabled on vcpu0, but disabled on vcpu1. I don't think it's expected. On the other hand, the information stored in these 3 registers needs to be migrated through {GET,SET}_ONE_REG by VMM (QEMU). all the information stored in these 3 registers are all same on all vcpus, which is exactly as we expect. In migration circumstance, we're transporting identical information for all vcpus and it's unnecessary. Thanks, Gavin _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm