Skip to content

Commit

Permalink
hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init
Browse files Browse the repository at this point in the history
This removes a hidden use of qemu_host_page_size, hoisting
two uses of qemu_real_host_page_size to a local variable.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Helge Deller <deller@gmx.de>
  • Loading branch information
rth7680 committed Feb 22, 2024
1 parent 7cdaef1 commit 9f9fe60
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/tpm/tpm_ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
void tpm_ppi_init(TPMPPI *tpmppi, MemoryRegion *m,
hwaddr addr, Object *obj)
{
tpmppi->buf = qemu_memalign(qemu_real_host_page_size(),
HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE));
size_t host_page_size = qemu_real_host_page_size();

tpmppi->buf = qemu_memalign(host_page_size,
ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi",
TPM_PPI_ADDR_SIZE, tpmppi->buf);
vmstate_register_ram(&tpmppi->ram, DEVICE(obj));
Expand Down

0 comments on commit 9f9fe60

Please sign in to comment.