Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B2A6C433DF for ; Tue, 28 Jul 2020 17:52:13 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D86FF20672 for ; Tue, 28 Jul 2020 17:52:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D86FF20672 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k0Tle-0006hX-Oa; Tue, 28 Jul 2020 17:51:58 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k0Tle-0006hS-3L for xen-devel@lists.xenproject.org; Tue, 28 Jul 2020 17:51:58 +0000 X-Inumbo-ID: 077d85ce-d0fb-11ea-a91f-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 077d85ce-d0fb-11ea-a91f-12813bfff9fa; Tue, 28 Jul 2020 17:51:57 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AE6A2AC50; Tue, 28 Jul 2020 17:52:07 +0000 (UTC) Subject: Re: [PATCH] x86/vhpet: Fix type size in timer_int_route_valid To: Andrew Cooper , Eslam Elnikety References: <20200728083357.77999-1-elnikety@amazon.com> From: Jan Beulich Message-ID: <278f0f31-619b-a392-6627-e75e65d0d14f@suse.com> Date: Tue, 28 Jul 2020 19:51:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel@lists.xenproject.org, =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Wei Liu , Paul Durrant Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 28.07.2020 11:26, Andrew Cooper wrote: > Does this work? > > diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c > index ca94e8b453..638f6174de 100644 > --- a/xen/arch/x86/hvm/hpet.c > +++ b/xen/arch/x86/hvm/hpet.c > @@ -62,8 +62,7 @@ > >  #define timer_int_route(h, n)    MASK_EXTR(timer_config(h, n), > HPET_TN_ROUTE) > > -#define timer_int_route_cap(h, n) \ > -    MASK_EXTR(timer_config(h, n), HPET_TN_INT_ROUTE_CAP) > +#define timer_int_route_cap(h, n) (h)->hpet.timers[(n)].route Seeing that this is likely the route taken here, and hence to avoid an extra round trip, two remarks: Here I see no need for the parentheses inside the square brackets. > diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h > index f0e0eaec83..a41fc443cc 100644 > --- a/xen/include/asm-x86/hvm/vpt.h > +++ b/xen/include/asm-x86/hvm/vpt.h > @@ -73,7 +73,13 @@ struct hpet_registers { >      uint64_t isr;               /* interrupt status reg */ >      uint64_t mc64;              /* main counter */ >      struct {                    /* timers */ > -        uint64_t config;        /* configuration/cap */ > +        union { > +            uint64_t config;    /* configuration/cap */ > +            struct { > +                uint32_t _; > +                uint32_t route; > +            }; > +        }; So long as there are no static initializers for this construct that would then suffer the old-gcc problem, this is of course a fine arrangement to make. Jan