Michael Ellerman [off-list ref] writes:
Thiago Jung Bauermann [off-list ref] writes:
quoted
Michael Ellerman [off-list ref] writes:
quoted
Thiago Jung Bauermann [off-list ref] writes:
quoted
From: Ryan Grimm <redacted>
User space might want to know it's running in a secure VM. It can't do
a mfmsr because mfmsr is a privileged instruction.
The solution here is to create a cpu attribute:
/sys/devices/system/cpu/svm
which will read 0 or 1 based on the S bit of the guest's CPU 0.
Why CPU 0?
If we have different CPUs running with different MSR_S then something
has gone badly wrong, no?
Yes, that would be very bad.
quoted
So can't we just read the MSR on whatever CPU the sysfs code happens to
run on.
Good point. I made the change in the patch below.
The patch looks good. Although, it raises the question of whether it
should be an attribute of the CPU at all.
I guess there's not obviously anywhere better for it.
Ok. TBH this patch is not as urgent as the others. It was added so that
tests have an easy way to tell if they're in an SVM. I can leave it out
for now to figure out if there's a better place for this information.
Still you should document the attribute in Documentation/ABI/testing/sysfs-devices-system-cpu
Indedd, will do that.
--
Thiago Jung Bauermann
IBM Linux Technology Center