[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 for-7.1] vfio/common: remove spurious tpm-crb-cmd misalign
|
From: |
Eric Auger |
|
Subject: |
Re: [PATCH v2 for-7.1] vfio/common: remove spurious tpm-crb-cmd misalignment warning |
|
Date: |
Fri, 18 Mar 2022 17:37:16 +0100 |
|
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
Hi,
On 3/18/22 5:18 PM, Philippe Mathieu-Daudé wrote:
> On 18/3/22 16:01, Eric Auger wrote:
>> The CRB command buffer currently is a RAM MemoryRegion and given
>> its base address alignment, it causes an error report on
>> vfio_listener_region_add(). This region could have been a RAM device
>> region, easing the detection of such safe situation but this option
>> was not well received. So let's add a helper function that uses the
>> memory region owner type to detect the situation is safe wrt
>> the assignment. Other device types can be checked here if such kind
>> of problem occurs again.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>
>> ---
>>
>> v1 -> v2:
>> - do not check the MR name but rather the owner type
>> ---
>> hw/vfio/common.c | 27 ++++++++++++++++++++++++++-
>> hw/vfio/trace-events | 1 +
>> 2 files changed, 27 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index 080046e3f51..98b0b6fb8c7 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -40,6 +40,7 @@
>> #include "trace.h"
>> #include "qapi/error.h"
>> #include "migration/migration.h"
>> +#include "sysemu/tpm.h"
>
>> +static bool vfio_known_safe_misalignment(MemoryRegionSection *section)
>> +{
>> + MemoryRegion *mr = section->mr;
>> +
>> + if (!object_dynamic_cast(mr->owner, TYPE_TPM_CRB)) {
>
> Using TPM_IS_CRB() instead:
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Hum yes, missed that define. Alex, with that fix, does it match your
expectation. Do we really want to add the dynamic trace point for safe
misalignments or don't we care?
Thanks
Eric