From patchwork Wed Jul 1 10:27:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11636025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1383A13B6 for ; Wed, 1 Jul 2020 10:28:22 +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 EAC6F2067D for ; Wed, 1 Jul 2020 10:28:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAC6F2067D 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 1jqZxq-0001wd-Hy; Wed, 01 Jul 2020 10:27:38 +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 1jqZxp-0001wT-KF for xen-devel@lists.xenproject.org; Wed, 01 Jul 2020 10:27:37 +0000 X-Inumbo-ID: 7b5abf4c-bb85-11ea-86e8-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 7b5abf4c-bb85-11ea-86e8-12813bfff9fa; Wed, 01 Jul 2020 10:27:36 +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 0A06EAD04; Wed, 1 Jul 2020 10:27:36 +0000 (UTC) Subject: [PATCH v2 5/7] x86: generalize padding field handling From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: <83274416-2812-53c9-f8cb-23ebdf73782e@suse.com> Date: Wed, 1 Jul 2020 12:27:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US 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: Stefano Stabellini , Julien Grall , Wei Liu , Paul Durrant , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The original intention was to ignore padding fields, but the pattern matched only ones whose names started with an underscore. Also match fields whose names are in line with the C spec by not having a leading underscore. (Note that the leading ^ in the sed regexps was pointless and hence get dropped.) This requires adjusting some vNUMA macros, to avoid triggering "enumeration value ... not handled in switch" warnings, which - due to -Werror - would cause the build to fail. (I have to admit that I find these padding fields odd, when translation of the containing structure is needed anyway.) Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- While for translation macros skipping padding fields pretty surely is a reasonable thing to do, we may want to consider not ignoring them when generating checking macros. --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -354,10 +354,13 @@ int compat_memory_op(unsigned int cmd, X return -EFAULT; #define XLAT_vnuma_topology_info_HNDL_vdistance_h(_d_, _s_) \ + case XLAT_vnuma_topology_info_vdistance_pad: \ guest_from_compat_handle((_d_)->vdistance.h, (_s_)->vdistance.h) #define XLAT_vnuma_topology_info_HNDL_vcpu_to_vnode_h(_d_, _s_) \ + case XLAT_vnuma_topology_info_vcpu_to_vnode_pad: \ guest_from_compat_handle((_d_)->vcpu_to_vnode.h, (_s_)->vcpu_to_vnode.h) #define XLAT_vnuma_topology_info_HNDL_vmemrange_h(_d_, _s_) \ + case XLAT_vnuma_topology_info_vmemrange_pad: \ guest_from_compat_handle((_d_)->vmemrange.h, (_s_)->vmemrange.h) XLAT_vnuma_topology_info(nat.vnuma, &cmp.vnuma); --- a/xen/tools/get-fields.sh +++ b/xen/tools/get-fields.sh @@ -218,7 +218,7 @@ for line in sys.stdin.readlines(): fi ;; [\,\;]) - if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] + if [ $level = 2 -a -n "$(echo $id | $SED 's,_\?pad[[:digit:]]*,,')" ] then if [ $kind = union ] then @@ -347,7 +347,7 @@ build_body () fi ;; [\,\;]) - if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] + if [ $level = 2 -a -n "$(echo $id | $SED 's,_\?pad[[:digit:]]*,,')" ] then if [ -z "$array" -a -z "$array_type" ] then @@ -437,7 +437,7 @@ check_field () id=$token ;; [\,\;]) - if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] + if [ $level = 2 -a -n "$(echo $id | $SED 's,_\?pad[[:digit:]]*,,')" ] then check_field $1 $2 $3.$id "$fields" test "$token" != ";" || fields= id= @@ -491,7 +491,7 @@ build_check () test $level != 2 -o $arrlvl != 1 || id=$token ;; [\,\;]) - if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] + if [ $level = 2 -a -n "$(echo $id | $SED 's,_\?pad[[:digit:]]*,,')" ] then check_field $kind $1 $id "$fields" test "$token" != ";" || fields= id=