[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 11/10] hvmloader: use memory type constants


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 21 Dec 2022 07:56:55 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zPjWrfvNt2Tbc1Uvv3IB3if8+YSTHyMS+Vhnt9u+/to=; b=da8BdblrZcLNF5ZjoHfW/yJETHS2aM97bgQuD/eNhDR2MBPfEagM7Vo3QkVvsQra4R0NLYTERjQsSLJKCggFQRxNi0X0wP/h2qoulQWl7dq5kPG7/X2PZ+8LpylwtA/AxuHldZHIPBJ811Ins3lzIVokSvmv3CNFLo0cCvTPznk0DlAI3tolGVKM8P3CjJLv5h8RYWjQujVqzKiz+PJV+2BZsKgI/3IWXloGAZPIM0QL1tbZcGKEWZYLHyRJbYPpMk5693vQBry5NV/imTpavt96sDAujEfq+0oAtymZWKUhMu2Y8PAJTQBlJnO2yAoFgkwO8sy+TQqiKurLc/pNIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZtPznVuxIB3k1QO4gqVzYETWY95OW9V8BDP/NlJNzXG7CquD4Nqai1I3bZLOsB7XPd4V/DJq8fv2hT+E9FSrPE5GiWdemSI1IL8K5/LRa+B4hubEWu79fohMAuc34rNGLa4vHDvuqX6jE3e1cNBAOr/8//H1F83lctJuQKL9bjfLSjl0GyV/gu7CMROT0a3hcKX8I0JMoEGVrMee0KwUWiEkgnrxKv0Fv//ahVHpwBm+9iqlGchG52uJaxTREhS7AKI0JjNj0VBC7wYLmJe9UoV1MtUzwz1jPKrbXD3QNZd8rLypHTsMjNsf0f2xbSN+dZBJzv3XAUMz+iceCA+nA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 21 Dec 2022 06:57:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.12.2022 18:45, Demi Marie Obenour wrote:
> On Tue, Dec 20, 2022 at 05:13:04PM +0100, Jan Beulich wrote:
>> --- a/tools/firmware/hvmloader/cacheattr.c
>> +++ b/tools/firmware/hvmloader/cacheattr.c
>> @@ -22,6 +22,8 @@
>>  #include "util.h"
>>  #include "config.h"
>>  
>> +#include <xen/asm/x86-defns.h>
>> +
>>  #define MSR_MTRRphysBase(reg) (0x200 + 2 * (reg))
>>  #define MSR_MTRRphysMask(reg) (0x200 + 2 * (reg) + 1)
>>  #define MSR_MTRRcap          0x00fe
>> @@ -71,23 +73,32 @@ void cacheattr_init(void)
>>  
>>      addr_mask = ((1ull << phys_bits) - 1) & ~((1ull << 12) - 1);
>>      mtrr_cap = rdmsr(MSR_MTRRcap);
>> -    mtrr_def = (1u << 11) | 6; /* E, default type WB */
>> +    mtrr_def = (1u << 11) | X86_MT_WB; /* E, default type WB */
>>  
>>      /* Fixed-range MTRRs supported? */
>>      if ( mtrr_cap & (1u << 8) )
>>      {
>> +#define BCST2(mt) ((mt) | ((mt) << 8))
>> +#define BCST4(mt) (BCST2(mt) | (BCST2(mt) << 16))
> 
> This should include a cast to uint32_t, just like BCST8 includes a cast
> to uint64_t.  It doesn’t have any functional impact since none of the
> memory types have the high bit set, but it makes the correctness of the
> code much more obvious to readers.

I've already followed Andrew's suggestion.

> With the suggested change:
> 
> Acked-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>

Thanks. Since I've addressed this differently, I'll hold back applying
of this.

>From a formal perspective I'd also like to point out that an Acked-by:
from a person not being maintainer of any code being changed by a patch
has no meaning at all. Only Reviewed-by: has a meaning (but of course
implies more thorough looking at the change than Acked-by: does).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.