SEV: Update ReducedPhysBits

Updating this field, as `cpuid` provides host level data, which is not
what a guest would expect for Reduced Phsycial Bits. In almost all
cases, we should be using `1` for the value here.

Amend: Adding unit test change.

Fixes: #5006

Signed-off-by: Larry Dewey <larry.dewey@amd.com>
(cherry picked from commit 67b8f0773f)
This commit is contained in:
Larry Dewey 2022-08-25 13:43:05 -05:00 committed by Archana Shinde
parent 98f60c100c
commit 123c867172
2 changed files with 2 additions and 2 deletions

View File

@ -261,7 +261,7 @@ func (q *qemuAmd64) appendProtectionDevice(devices []govmmQemu.Device, firmware,
Debug: false,
File: firmware,
CBitPos: cpuid.AMDMemEncrypt.CBitPosition,
ReducedPhysBits: cpuid.AMDMemEncrypt.PhysAddrReduction,
ReducedPhysBits: 1,
}), "", nil
case noneProtection:
return devices, firmware, nil

View File

@ -287,7 +287,7 @@ func TestQemuAmd64AppendProtectionDevice(t *testing.T) {
Debug: false,
File: firmware,
CBitPos: cpuid.AMDMemEncrypt.CBitPosition,
ReducedPhysBits: cpuid.AMDMemEncrypt.PhysAddrReduction,
ReducedPhysBits: 1,
},
}