From nobody Tue May 21 23:08:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1700689644; cv=none; d=zohomail.com; s=zohoarc; b=RUyXNPgM1rkTf2mYjxDD7qJAmiIwQHLyu0xtIz+5MBV1gMCBkXU4pIlIahWrdjpsyVL4RYoVDWsa/qS2+AozAz5MI70/U8rvW/HJH5ms/VRPMWXKLPvHDwXzZHN7ZlT0FC3CHG5wRMadSsZrnYG4D3dvNFLS1WHwwcNm8eLsd6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700689644; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VvsG03w+oL5P92r6v6TpvX68MhPQGcRFEDT4mwNf7Vg=; b=KtTVnzKnZz+jz6o9XlLU4rcg5OYc4IIXFRvn7rg21XbLglgEIVqb0JSehh6BRerrAPfrPcPUcyAwXZgcrB6JjQtRO8vNvRDsTncJ2rTMyahL4HhFWny1ltR4HfVme2rWIMFeAZEUEagzpX/7yR7iIvsdLWwzKdXA9la0M3ZXGNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1700689644879631.4346737397088; Wed, 22 Nov 2023 13:47:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.639201.996207 (Exim 4.92) (envelope-from ) id 1r5v3e-00006S-AW; Wed, 22 Nov 2023 21:46:54 +0000 Received: by outflank-mailman (output) from mailman id 639201.996207; Wed, 22 Nov 2023 21:46:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5v3e-00006L-7o; Wed, 22 Nov 2023 21:46:54 +0000 Received: by outflank-mailman (input) for mailman id 639201; Wed, 22 Nov 2023 21:46:52 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5v3c-00006F-Av for xen-devel@lists.xenproject.org; Wed, 22 Nov 2023 21:46:52 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [2604:1380:4601:e00::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a3f3d083-8980-11ee-9b0e-b553b5be7939; Wed, 22 Nov 2023 22:46:50 +0100 (CET) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id D9EFCB827AC; Wed, 22 Nov 2023 21:46:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA7AFC433C8; Wed, 22 Nov 2023 21:46:46 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a3f3d083-8980-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700689607; bh=LRkoP6ih25g5CenKtlE7D41MaEgKKhlp0jpndEkCi6E=; h=Date:From:To:cc:Subject:From; b=liK0uIN1h4qos8kNOaTH60qNMnRT6VlvZAYbS1/S1ARosiMTKpFJkVWsS8tvK6JQP vJi4jZg5m2fBucqpYIjJGQytUdfY7BTpEM+ayqs+7nzr9xtKCVQo3LsuVNLamDiVA6 mLx07tSWe4lifANRiAp7dUwCK0vwVWV96Dl7BvcNgEH8ehFmTd1ocgXGqy5nv0nUCW BcCN9ZDfruWYQ5UtaZAVhPvp4mmyC7sH0IcOZwXNaFN8WnLNhFxao9tprH+1kgVlqA r6kopx+PYBmbTNIO7nhbb1u03NzAH9fqav5Vxt9cdc/7udrQh4lf4vKK8IhKKEKnl+ AM1W3rYdJJ+1g== Date: Wed, 22 Nov 2023 13:46:45 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: sstabellini@kernel.org, federico.serafini@bugseng.com, Jan Beulich , Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Bertrand Marquis Subject: [PATCH] do_multicall and MISRA Rule 8.3 Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1700689645449100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Two out of three do_multicall definitions/declarations use uint32_t as type for the "nr_calls" parameters. Change the third one to be consistent with the other two.=20 Link: https://lore.kernel.org/xen-devel/7e3abd4c0ef5127a07a60de1bf090a8aefa= c8e5c.1692717906.git.federico.serafini@bugseng.com/ Link: https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2308251502430.6= 458@ubuntu-linux-20-04-desktop/ Signed-off-by: Stefano Stabellini --- Note that a previous discussion showed disagreement between maintainers on this topic. The source of disagreements are that we don't want to change a guest-visible ABI and we haven't properly documented how to use types for guest ABIs. As an example, fixed-width types have the advantage of being explicit about their size but sometimes register-size types are required (e.g. unsigned long). The C specification says little about the size of unsigned long and today, and we even use unsigned int in guest ABIs without specifying the expected width of unsigned int on the various arches. As Jan pointed out, in Xen we assume sizeof(int) >=3D 4, but that's not written anywhere as far as I can tell. I think the appropriate solution would be to document properly our expectations of both fixed-width and non-fixed-width types, and how to use them for guest-visible ABIs. In this patch I used uint32_t for a couple of reasons: - until we have better documentation, I feel more confident in using explicitly-sized integers in guest-visible ABIs - 2/3 of the do_multicall definition/declaration are using uint32_t diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c index 6d361ddfce..8b8ee16074 100644 --- a/xen/include/hypercall-defs.c +++ b/xen/include/hypercall-defs.c @@ -172,7 +172,7 @@ console_io(unsigned int cmd, unsigned int count, char *= buffer) vm_assist(unsigned int cmd, unsigned int type) event_channel_op(int cmd, void *arg) mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsi= gned int foreigndom) -multicall(multicall_entry_t *call_list, unsigned int nr_calls) +multicall(multicall_entry_t *call_list, uint32_t nr_calls) #ifdef CONFIG_PV mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, u= nsigned int foreigndom) stack_switch(unsigned long ss, unsigned long esp)