qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Stefan Berger" <stefanb@linux.ibm.com>
Subject: Re: [PATCH v3 1/4] tpm: mark correct memory region range dirty when clearing RAM
Date: Mon, 26 Jul 2021 18:58:31 +0200	[thread overview]
Message-ID: <d88d74e3-aac3-0a04-abeb-407eee2d3c15@redhat.com> (raw)
In-Reply-To: <YP7ph0a9kI9p4zhs@t490s>

On 26.07.21 18:57, Peter Xu wrote:
> On Mon, Jul 26, 2021 at 06:03:43PM +0200, David Hildenbrand wrote:
>> We might not start at the beginning of the memory region. Let's
>> calculate the offset into the memory region via the difference in the
>> host addresses.
>>
>> Acked-by: Stefan Berger <stefanb@linux.ibm.com>
>> Fixes: ffab1be70692 ("tpm: clear RAM when "memory overwrite" requested")
>> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Cc: Alex Williamson <alex.williamson@redhat.com>
>> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: Claudio Fontana <cfontana@suse.de>
>> Cc: Thomas Huth <thuth@redhat.com>
>> Cc: "Alex Bennée" <alex.bennee@linaro.org>
>> Cc: Peter Xu <peterx@redhat.com>
>> Cc: Laurent Vivier <lvivier@redhat.com>
>> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   hw/tpm/tpm_ppi.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c
>> index 362edcc5c9..f243d9d0f6 100644
>> --- a/hw/tpm/tpm_ppi.c
>> +++ b/hw/tpm/tpm_ppi.c
>> @@ -30,11 +30,14 @@ void tpm_ppi_reset(TPMPPI *tpmppi)
>>           guest_phys_blocks_init(&guest_phys_blocks);
>>           guest_phys_blocks_append(&guest_phys_blocks);
>>           QTAILQ_FOREACH(block, &guest_phys_blocks.head, next) {
>> +            hwaddr mr_offs = (uint8_t *)memory_region_get_ram_ptr(block->mr) -
>> +                             block->host_addr;
> 
> Didn't look closely previous - should it be reversed instead?
> 
>    block->host_addr - memory_region_get_ram_ptr(block->mr)

Of course it should :(

Thanks! :)

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2021-07-26 17:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 16:03 [PATCH v3 0/4] softmmu/memory_mapping: optimize dump/tpm for virtio-mem David Hildenbrand
2021-07-26 16:03 ` [PATCH v3 1/4] tpm: mark correct memory region range dirty when clearing RAM David Hildenbrand
2021-07-26 16:57   ` Peter Xu
2021-07-26 16:58     ` David Hildenbrand [this message]
2021-07-26 16:03 ` [PATCH v3 2/4] softmmu/memory_mapping: never merge ranges accross memory regions David Hildenbrand
2021-07-26 16:03 ` [PATCH v3 3/4] softmmu/memory_mapping: factor out adding physical memory ranges David Hildenbrand
2021-07-26 16:03 ` [PATCH v3 4/4] softmmu/memory_mapping: optimize for RamDiscardManager sections David Hildenbrand
  -- strict thread matches above, loose matches on Subject: below --
2021-07-21  8:38 [PATCH v3 0/4] softmmu/memory_mapping: optimize dump/tpm for virtio-mem David Hildenbrand
2021-07-21  8:38 ` [PATCH v3 1/4] tpm: mark correct memory region range dirty when clearing RAM David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d88d74e3-aac3-0a04-abeb-407eee2d3c15@redhat.com \
    --to=david@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=cfontana@suse.de \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).