[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 105/115] target/i386: sev: Remove redundant cbitpos and reduced_ph
From: |
Paolo Bonzini |
Subject: |
[PULL 105/115] target/i386: sev: Remove redundant cbitpos and reduced_phys_bits fields |
Date: |
Thu, 11 Jun 2020 15:44:39 -0400 |
From: David Gibson <david@gibson.dropbear.id.au>
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>
---
target/i386/sev.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 9e8ab7b056..d25af37136 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -41,8 +41,6 @@ struct SEVState {
uint8_t build_id;
uint32_t policy;
uint64_t me_mask;
- uint32_t cbitpos;
- uint32_t reduced_phys_bits;
uint32_t handle;
int sev_fd;
SevState state;
@@ -378,13 +376,13 @@ sev_get_me_mask(void)
uint32_t
sev_get_cbit_position(void)
{
- return sev_guest ? sev_guest->state.cbitpos : 0;
+ return sev_guest ? sev_guest->cbitpos : 0;
}
uint32_t
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 *
@@ -713,22 +711,19 @@ sev_guest_init(const char *id)
host_cpuid(0x8000001F, 0, NULL, &ebx, NULL, NULL);
host_cbitpos = ebx & 0x3f;
- s->cbitpos = object_property_get_int(OBJECT(sev), "cbitpos", NULL);
- if (host_cbitpos != s->cbitpos) {
+ if (host_cbitpos != sev->cbitpos) {
error_report("%s: cbitpos check failed, host '%d' requested '%d'",
- __func__, host_cbitpos, s->cbitpos);
+ __func__, host_cbitpos, sev->cbitpos);
goto err;
}
- s->reduced_phys_bits = object_property_get_int(OBJECT(sev),
- "reduced-phys-bits", NULL);
- if (s->reduced_phys_bits < 1) {
+ if (sev->reduced_phys_bits < 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;
}
- s->me_mask = ~(1UL << s->cbitpos);
+ s->me_mask = ~(1UL << sev->cbitpos);
devname = object_property_get_str(OBJECT(sev), "sev-device", NULL);
s->sev_fd = open(devname, O_RDWR);
--
2.26.2
- [PULL 097/115] i386: hvf: Move mmio_buf into CPUX86State, (continued)
- [PULL 097/115] i386: hvf: Move mmio_buf into CPUX86State, Paolo Bonzini, 2020/06/11
- [PULL 096/115] i386: hvf: Move lazy_flags into CPUX86State, Paolo Bonzini, 2020/06/11
- [PULL 098/115] i386: hvf: Drop HVFX86EmulatorState, Paolo Bonzini, 2020/06/11
- [PULL 093/115] i386: hvf: Drop rflags from HVFX86EmulatorState, Paolo Bonzini, 2020/06/11
- [PULL 087/115] i386: hvf: Move HVFState definition into hvf, Paolo Bonzini, 2020/06/11
- [PULL 101/115] target/i386: sev: Move local structure definitions into .c file, Paolo Bonzini, 2020/06/11
- [PULL 100/115] target/i386: sev: Remove unused QSevGuestInfoClass, Paolo Bonzini, 2020/06/11
- [PULL 102/115] target/i386: sev: Rename QSevGuestInfo, Paolo Bonzini, 2020/06/11
- [PULL 058/115] disas: Let disas::read_memory() handler return EIO on error, Paolo Bonzini, 2020/06/11
- [PULL 104/115] target/i386: sev: Partial cleanup to sev_state global, Paolo Bonzini, 2020/06/11
- [PULL 105/115] target/i386: sev: Remove redundant cbitpos and reduced_phys_bits fields,
Paolo Bonzini <=
- [PULL 073/115] replay: implement fair mutex, Paolo Bonzini, 2020/06/11
- [PULL 103/115] target/i386: sev: Embed SEVState in SevGuestState, Paolo Bonzini, 2020/06/11
- [PULL 107/115] target/i386: sev: Remove redundant handle field, Paolo Bonzini, 2020/06/11
- [PULL 108/115] target/i386: sev: Unify SEVState and SevGuestState, Paolo Bonzini, 2020/06/11
- [PULL 109/115] checkpatch: reversed logic with acpi test checks, Paolo Bonzini, 2020/06/11
- [PULL 099/115] xen: fix build without pci passthrough, Paolo Bonzini, 2020/06/11
- [PULL 110/115] exec/memory: Remove unused MemoryRegionMmio type, Paolo Bonzini, 2020/06/11
- [PULL 114/115] stubs: move Xen stubs to accel/, Paolo Bonzini, 2020/06/11
- [PULL 111/115] hw/usb: Move device-specific declarations to new 'hcd-musb.h' header, Paolo Bonzini, 2020/06/11
- [PULL 113/115] replay: fix replay shutdown for console mode, Paolo Bonzini, 2020/06/11