mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-16 01:03:31 +00:00
target/i386: sev: Remove redundant cbitpos and reduced_phys_bits fields
The SEVState structure has cbitpos and reduced_phys_bits fields which are simply copied from the SevGuestState structure and never changed. Now that SEVState is embedded in SevGuestState we can just access the original copy directly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200604064219.436242-7-david@gibson.dropbear.id.au> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8673dee354
commit
a06d2bad05
|
@ -41,8 +41,6 @@ struct SEVState {
|
||||||
uint8_t build_id;
|
uint8_t build_id;
|
||||||
uint32_t policy;
|
uint32_t policy;
|
||||||
uint64_t me_mask;
|
uint64_t me_mask;
|
||||||
uint32_t cbitpos;
|
|
||||||
uint32_t reduced_phys_bits;
|
|
||||||
uint32_t handle;
|
uint32_t handle;
|
||||||
int sev_fd;
|
int sev_fd;
|
||||||
SevState state;
|
SevState state;
|
||||||
|
@ -378,13 +376,13 @@ sev_get_me_mask(void)
|
||||||
uint32_t
|
uint32_t
|
||||||
sev_get_cbit_position(void)
|
sev_get_cbit_position(void)
|
||||||
{
|
{
|
||||||
return sev_guest ? sev_guest->state.cbitpos : 0;
|
return sev_guest ? sev_guest->cbitpos : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
sev_get_reduced_phys_bits(void)
|
sev_get_reduced_phys_bits(void)
|
||||||
{
|
{
|
||||||
return sev_guest ? sev_guest->state.reduced_phys_bits : 0;
|
return sev_guest ? sev_guest->reduced_phys_bits : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SevInfo *
|
SevInfo *
|
||||||
|
@ -713,22 +711,19 @@ sev_guest_init(const char *id)
|
||||||
host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
|
host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
|
||||||
host_cbitpos = ebx & 0x3f;
|
host_cbitpos = ebx & 0x3f;
|
||||||
|
|
||||||
s->cbitpos = object_property_get_int(OBJECT(sev), "cbitpos", NULL);
|
if (host_cbitpos != sev->cbitpos) {
|
||||||
if (host_cbitpos != s->cbitpos) {
|
|
||||||
error_report("%s: cbitpos check failed, host '%d' requested '%d'",
|
error_report("%s: cbitpos check failed, host '%d' requested '%d'",
|
||||||
__func__, host_cbitpos, s->cbitpos);
|
__func__, host_cbitpos, sev->cbitpos);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->reduced_phys_bits = object_property_get_int(OBJECT(sev),
|
if (sev->reduced_phys_bits < 1) {
|
||||||
"reduced-phys-bits", NULL);
|
|
||||||
if (s->reduced_phys_bits < 1) {
|
|
||||||
error_report("%s: reduced_phys_bits check failed, it should be >=1,"
|
error_report("%s: reduced_phys_bits check failed, it should be >=1,"
|
||||||
" requested '%d'", __func__, s->reduced_phys_bits);
|
" requested '%d'", __func__, sev->reduced_phys_bits);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->me_mask = ~(1UL << s->cbitpos);
|
s->me_mask = ~(1UL << sev->cbitpos);
|
||||||
|
|
||||||
devname = object_property_get_str(OBJECT(sev), "sev-device", NULL);
|
devname = object_property_get_str(OBJECT(sev), "sev-device", NULL);
|
||||||
s->sev_fd = open(devname, O_RDWR);
|
s->sev_fd = open(devname, O_RDWR);
|
||||||
|
|
Loading…
Reference in a new issue