From patchwork Mon Aug 15 18:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 12944038 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE760C25B0E for ; Mon, 15 Aug 2022 20:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346163AbiHOUNV (ORCPT ); Mon, 15 Aug 2022 16:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244673AbiHOUJn (ORCPT ); Mon, 15 Aug 2022 16:09:43 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-eastus2azon11021024.outbound.protection.outlook.com [52.101.57.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C63B84EC0; Mon, 15 Aug 2022 11:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c6+AVY9GpsCv7Ke9pNLLLJt4buMHBs+thXD5d2SMAMpGqxA/622CXZrMSM6CVW7F7ImTUzYr53QiIwYn3t1EFPbpZjt5H0FRLyzn1v2GGstn6gIxvgjQgFk0x8D/lFXyH21FWrQA95SBoqw8y5kFGpZydYVFYIF9CP/o41FgvEIQD/ap/IkUDT3SP+H+clhz53WxBOrbq4es/36p60ySmeb20tfHbhB4cI1T7U6+hSQLDDXkfLCMcHc6L0sQM1F0KDTPpV46cSDZEXplqyR98i296kIqE0nen9IatR1AGAicDquUMdnoPAFPxAp4Bm8nFCP0Tc/UEczih6J1QsiyAw== 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=5083/8B01yFp2faTJGAh4yAMLUgiLV2WVO+eUItyvNE=; b=Rw1Et9Wn3Y/AgM01r5nIvSIoKxle5jutSpF0i3haxGI+nWCmcfYl56Xh1f+DQ7NpJjy2N4CQeVYwoIJBgj4PboKEW8QhDN/ELjvq03OJptZAtTuUg/uxOlRgQthtMKxkw5tbyCnnEuAFh9AiwnCg5xOqCt2Nm6GWBU4M0D2JehH0yIBT0cdY6PP7URn5uzVUsdukLMeFVPBkuF3et8hcyej1sKTeW8Q1nDhg3aHmEUetTUAdiOuSGtIvyH3kHA85Ewd7fI2Fy7HQEh6Sf3QnF/ZNAD4GVT/H9brQLbromQemmoIJQvWgnM73p/srrnZFjCa/hGPhYhmGpE+5hu89iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5083/8B01yFp2faTJGAh4yAMLUgiLV2WVO+eUItyvNE=; b=a9eXMzZtLs1BliGx/YeqzZftVXhmZym2FOaekDAk7cNT5aoxYqzLYyomHfhZX0UnT1lFoI43vgwT5U0rqvrQdstl/1Gq3YvwktHdOfkOBT9E6WoYl1nD6sIPTJ3rO0xlWhpLFVSt3angkOzo5wklC1mTz7wS0yD4q71S3Gann4o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from BL0PR2101MB1092.namprd21.prod.outlook.com (2603:10b6:207:30::23) by BY5PR21MB1393.namprd21.prod.outlook.com (2603:10b6:a03:236::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.15; Mon, 15 Aug 2022 18:55:56 +0000 Received: from BL0PR2101MB1092.namprd21.prod.outlook.com ([fe80::543e:7a5b:a5a5:f988]) by BL0PR2101MB1092.namprd21.prod.outlook.com ([fe80::543e:7a5b:a5a5:f988%6]) with mapi id 15.20.5546.014; Mon, 15 Aug 2022 18:55:56 +0000 From: Dexuan Cui To: quic_jhugo@quicinc.com, wei.liu@kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, lpieralisi@kernel.org, bhelgaas@google.com, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, mikelley@microsoft.com, robh@kernel.org, kw@linux.com, helgaas@kernel.org, alex.williamson@redhat.com, boqun.feng@gmail.com, Boqun.Feng@microsoft.com Cc: Dexuan Cui , Carl Vanderlip Subject: [PATCH] PCI: hv: Fix the definiton of vector in hv_compose_msi_msg() Date: Mon, 15 Aug 2022 11:55:05 -0700 Message-Id: <20220815185505.7626-1-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 Reply-To: decui@microsoft.com X-ClientProxiedBy: MW4PR04CA0207.namprd04.prod.outlook.com (2603:10b6:303:86::32) To BL0PR2101MB1092.namprd21.prod.outlook.com (2603:10b6:207:30::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98b45f0c-c986-4360-ef02-08da7eefc8c2 X-MS-TrafficTypeDiagnostic: BY5PR21MB1393:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k1AYR3mroC8JS5oqHSfUsYuro2ZjPAVUU12P6uP8Qt6Ay4ciag9wQHI2JdKpTLmBiLsBBNZjHcVsLq2PCsBJQRwultiKTueI//LAGxB1wEhikR5iTI0Wt2Z5Axkpgr7Ei4R/1TjihzU7DyYehWusJ7PpRIqcFv+jMgl7Y0z/nl8EPDuqPwFg/NvWbiobMaD8EqFjroJzBbPxcJ/tLMymm3o8oq9GgG7FJIVqgv17Qx4sMUSaKwOW869Ok2v3cRwggvAO3X6HRFPbU1+6UTuRYsA93HUxXinQGtYvT/8Oc1uD4n/SN6iBsHCa71L7qlbjl3yrnL6ouFAjCFOuO+g3T8nN4PKuPySV4zUYtoktC32N2jy0lYW8cO/Ca2SNHqlrOyPvHDmnabJpoFJ5MmN+F1P++eTCcQkgv6i/qhL9nZ+yEGE8g1BgnabbrDekxXFEDGXRE70yCHbob5cI2JNAji+ypLVgd6xepyvr+wPQWX+/I5lr7fIL14t5vQUZi1SJq1AWyh+IgdZ98NHET8xDxbCR8avMAeDnLD+o56s+8/HY694Yhfp16+zUesOAtjIULzjZonsVjOmCNZVLaHR9Kh3OEGdV42DaK4d0jmnqwaCV00AVovscxx8yu9JqjN4FZiV4VHmw65nsB3cxZzEH80BXkmJwKWlSaF08c9hS4eJD3JjTjAchAzdN2luDkQCTHr6N2fQ6PmYgRisVny92q1N5JhZYUKzz7NJ9xnd1s2GvpHn4qwSGvOPrdyr4TvRpOFo301tis7JNBMGj9xsr26i5/l/nbF8GDjIWbxj5djzY1YzJVb3jMCgJ1dAvG2HNX6+I84w4SGSzSaqinmacUA0pyHWl3Gbaj5pUdPH7rrU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR2101MB1092.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(376002)(346002)(396003)(39860400002)(136003)(451199009)(86362001)(6512007)(2616005)(3450700001)(2906002)(6506007)(921005)(52116002)(82950400001)(82960400001)(83380400001)(186003)(6666004)(1076003)(38100700002)(36756003)(8936002)(966005)(6486002)(316002)(478600001)(66556008)(4326008)(66946007)(8676002)(5660300002)(66476007)(41300700001)(10290500003)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z+g5Q7Zk4ia2TSwvuOr9E2j+m/htxfb++0rfdAie0ZNqZkFU1Cqc8or3UgoJgHfSieKuOPbYznFrKSREAtHDhfM+kyOoo1zDfp9Rs1x3TaMSCf6f8kQcifnnM9bF4d8AySR7gvKlbAX8coUiFVfHxRVzv1eVBYQzEEEdl5tWZF/9m8XDwvFqiOAz6rYTWLTY24lspkoXdVBXH228sQCPIcRI9rfYSpCWm3ncrvyE6HtU7mK7GwIFhU0D9zAVQRlHWHV9I61OIN1ucDknP4eSDo9Odn9ytuH3WFYe04A+pRHb7ycBJHWyS9ySIhH2LT8EauLCfGe5RjitEsV+NezVRx9Yz8PVFu3ZE8MjS9crVHxVBaJourUf2y7Ls3f5hHnbn0LgpTxmsSfSUff4eEw1tc03ZXsQ6QrbNJnfpmFE0gCaOuw4J0WfdPxI6NY5vvo1po6ta7SPVUBTtm/h4jCotUmy/CkldgYGcn6roHZNVYP40W1mx1eLf1hiOP9XydoonAsDOVCRA/1vOOKu9iIW42m1Q9urhC8m4aaeDM/I8ewue5jfpPALzlVe76+4UYY0nbio3uyKvUO07n0BveBT5LGHy0Zp7RFAZC8qeZJdisrNDPBNXN8ZJpKBhaJg/ZBRAYNRMXgqV0jxt3wgbnsvaTbUeAEf4gWYhVXUO+bsSrOw5T X-OriginatorOrg: microsoft.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR21MB1393 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The local variable 'vector' must be u32 rather than u8: see the struct hv_msi_desc3. 'vector_count' should be u16 rather than u8: see struct hv_msi_desc, hv_msi_desc2 and hv_msi_desc3. Fixes: a2bad844a67b ("PCI: hv: Fix interrupt mapping for multi-MSI") Signed-off-by: Dexuan Cui Cc: Jeffrey Hugo Cc: Carl Vanderlip --- The patch should be appplied after the earlier patch: [PATCH] PCI: hv: Only reuse existing IRTE allocation for Multi-MSI https://lwn.net/ml/linux-kernel/20220804025104.15673-1-decui%40microsoft.com/ drivers/pci/controller/pci-hyperv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 65d0dab25deb..53580899c859 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1614,7 +1614,7 @@ static void hv_pci_compose_compl(void *context, struct pci_response *resp, static u32 hv_compose_msi_req_v1( struct pci_create_interrupt *int_pkt, struct cpumask *affinity, - u32 slot, u8 vector, u8 vector_count) + u32 slot, u8 vector, u16 vector_count) { int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE; int_pkt->wslot.slot = slot; @@ -1642,7 +1642,7 @@ static int hv_compose_msi_req_get_cpu(struct cpumask *affinity) static u32 hv_compose_msi_req_v2( struct pci_create_interrupt2 *int_pkt, struct cpumask *affinity, - u32 slot, u8 vector, u8 vector_count) + u32 slot, u8 vector, u16 vector_count) { int cpu; @@ -1661,7 +1661,7 @@ static u32 hv_compose_msi_req_v2( static u32 hv_compose_msi_req_v3( struct pci_create_interrupt3 *int_pkt, struct cpumask *affinity, - u32 slot, u32 vector, u8 vector_count) + u32 slot, u32 vector, u16 vector_count) { int cpu; @@ -1702,7 +1702,8 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) struct tran_int_desc *int_desc; struct msi_desc *msi_desc; bool multi_msi; - u8 vector, vector_count; + u32 vector; /* Must be u32: see the struct hv_msi_desc3 */ + u16 vector_count; struct { struct pci_packet pci_pkt; union {