qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Igor Mammedov" <imammedo@redhat.com>
Subject: Re: [PATCH v1 1/5] tpm: mark correct memory region range dirty when clearing RAM
Date: Sat, 13 Feb 2021 19:38:34 -0500	[thread overview]
Message-ID: <c27d2ad2-7209-9d99-8311-a8907822903b@linux.ibm.com> (raw)
In-Reply-To: <20210210171537.32932-2-david@redhat.com>

On 2/10/21 12:15 PM, David Hildenbrand wrote:
> We might not start at the beginning of the memory region. We could also
> calculate via the difference in the host address; however,
> memory_region_set_dirty() also relies on memory_region_get_ram_addr()
> internally, so let's just use that.
>
> 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: 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 | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c
> index 72d7a3d926..e0e2d2c8e1 100644
> --- a/hw/tpm/tpm_ppi.c
> +++ b/hw/tpm/tpm_ppi.c
> @@ -30,11 +30,13 @@ 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) {
> +            ram_addr_t mr_start = memory_region_get_ram_addr(block->mr);
> +
>               trace_tpm_ppi_memset(block->host_addr,
>                                    block->target_end - block->target_start);
>               memset(block->host_addr, 0,
>                      block->target_end - block->target_start);
> -            memory_region_set_dirty(block->mr, 0,
> +            memory_region_set_dirty(block->mr, block->target_start - mr_start,
>                                       block->target_end - block->target_start);
>           }
>           guest_phys_blocks_free(&guest_phys_blocks);

Acked-by: Stefan Berger <stefanb@linux.ibm.com>




  reply	other threads:[~2021-02-14  0:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 17:15 [PATCH v1 0/5] softmmu/memory_mapping: optimize dump/tpm for virtio-mem David Hildenbrand
2021-02-10 17:15 ` [PATCH v1 1/5] tpm: mark correct memory region range dirty when clearing RAM David Hildenbrand
2021-02-14  0:38   ` Stefan Berger [this message]
2021-02-10 17:15 ` [PATCH v1 2/5] softmmu/memory_mapping: reuse qemu_get_guest_simple_memory_mapping() David Hildenbrand
2021-02-10 17:15 ` [PATCH v1 3/5] softmmu/memory_mapping: never merge ranges accross memory regions David Hildenbrand
2021-02-10 17:15 ` [PATCH v1 4/5] softmmu/memory_mapping: factor out adding physical memory ranges David Hildenbrand
2021-02-10 17:15 ` [PATCH v1 5/5] softmmu/memory_mapping: optimize for RamDiscardMgr sections 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=c27d2ad2-7209-9d99-8311-a8907822903b@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=cfontana@suse.de \
    --cc=david@redhat.com \
    --cc=dgilbert@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.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).