From nobody Fri Apr 19 16:11:42 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602506746; cv=none; d=zohomail.com; s=zohoarc; b=RuEc4uWw5Ivilj6WlPvyuT4OmOPKvwMenPSXOhdY72/VUkux10AOv1CjhT95RGrtJHopA+3Dv3yftyWT+1SvBp8znGvWghkXIZjCQPnHltruHWfqcNUPVJOk0erHX3K+eIUpj+44fER1OZdsOrfx1xTLmcXC2S6Zieo3/VRQHjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602506746; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bwG8iSHLZW0tTYCnl2ic6/t6qmfYl8jGlMpgEnOotCs=; b=M1yqa8TRUb+njLKTw0mTXvlGEiufeJjyAK0EUUgYcqr83BzeiGMryJyjyDQMxD7PGjfTQxTwBm/hUZfoJNqp4YVBAFhKTPJbQJtpy/4pN9Dz6TfS126rHTu/B4Gj7AZ3qsMI4rzsj46fodwHARgDEBEZaiTYw7n/roHzpB+gIlA= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602506746129877.8669804668469; Mon, 12 Oct 2020 05:45:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.5925.15387 (Exim 4.92) (envelope-from ) id 1kRxCd-0002e1-VB; Mon, 12 Oct 2020 12:45:23 +0000 Received: by outflank-mailman (output) from mailman id 5925.15387; Mon, 12 Oct 2020 12:45:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCd-0002dq-R3; Mon, 12 Oct 2020 12:45:23 +0000 Received: by outflank-mailman (input) for mailman id 5925; Mon, 12 Oct 2020 12:45:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCc-0002cA-QF for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:22 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 47b22cc0-726e-4604-916d-836074c798f4; Mon, 12 Oct 2020 12:45:18 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-ZTed8B7mMT2VgJR1qKIMtQ-1; Mon, 12 Oct 2020 08:45:16 -0400 Received: by mail-wr1-f69.google.com with SMTP id r8so1941961wrp.5 for ; Mon, 12 Oct 2020 05:45:16 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id f6sm11016383wru.50.2020.10.12.05.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:14 -0700 (PDT) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCc-0002cA-QF for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:22 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 47b22cc0-726e-4604-916d-836074c798f4; Mon, 12 Oct 2020 12:45:18 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-ZTed8B7mMT2VgJR1qKIMtQ-1; Mon, 12 Oct 2020 08:45:16 -0400 Received: by mail-wr1-f69.google.com with SMTP id r8so1941961wrp.5 for ; Mon, 12 Oct 2020 05:45:16 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id f6sm11016383wru.50.2020.10.12.05.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:14 -0700 (PDT) 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: 47b22cc0-726e-4604-916d-836074c798f4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bwG8iSHLZW0tTYCnl2ic6/t6qmfYl8jGlMpgEnOotCs=; b=LoZqtaFZ14PMiVG5YwWZDLriI0xjyU7gGSiWQDnxzOKLHb3cwadDmXh61qzcP0A40ySUE2 MdBHKQ2YyjyqH2/HvUpEO+g/Lj8MJVewGgFov7OAbbgBhTP9E7hVojhpHOr9/MiNsDaQfr 5mQmXpW3qfQOevb7Xa+m/mWEKiM/jJg= X-MC-Unique: ZTed8B7mMT2VgJR1qKIMtQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bwG8iSHLZW0tTYCnl2ic6/t6qmfYl8jGlMpgEnOotCs=; b=PEGS2VG6nLVSQGMPuYGKhrprPynHlFS9z2eO3q7PdJhSCQ2Buud0LMRy/R7lEFasOY mboqhm5t2SboNEjnwmcu2eiN8fygnEDXoQB0U0yX0AwdEi/J7ovI4ANov3gcSMsTI3oS lhEBla/YNRydoMF6R5QB55oJPuFFFW2V1/eidXxRGSqsRZJFtL+hgb4exIeHkTbLlpE3 3/dhY6ZFeZzu9CrhaHmomO76lz5yiBG72NLEg0ALr9NXtEyL703uRELeyz6tqcz5lTuN A1CyqLDQkPeBWDqpUQ8uWIO0wJImQ5hmQQCHQxsH0+P/V2HWw9fsRITsboQ66j8pIcDm 0SyA== X-Gm-Message-State: AOAM532qndwIchDvDaxB/ZBwbTM20TLzhmh79FFxoBluYBG68dXdaAof 5Dy7aexgAHo7qdEv34JZzVH1OuY9Af0kIe/0Tb7lljW0JDyxyE/42Re4fZ8dJIyOZlWu8GkaAr9 7iOzXDwoMnkDtVmuI+/hISbf/5N0= X-Received: by 2002:adf:dd46:: with SMTP id u6mr29753240wrm.295.1602506715238; Mon, 12 Oct 2020 05:45:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyueR4JjpNH2sLzfTjSqD0R65Ts5ka4vohHBW3dn4ShgyH1BUlk0MTIhNUHnqavD80ySjglhw== X-Received: by 2002:adf:dd46:: with SMTP id u6mr29753217wrm.295.1602506715091; Mon, 12 Oct 2020 05:45:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Paul Durrant , Aurelien Jarno , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Jiaxun Yang , Yoshinori Sato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Stefano Stabellini , Helge Deller , Anthony Perard , Richard Henderson , Aleksandar Markovic , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Marcel Apfelbaum , Mark Cave-Ayland , Paolo Bonzini , Huacai Chen Subject: [PATCH 1/5] hw/pci-host/bonito: Make PCI_ADDR() macro more readable Date: Mon, 12 Oct 2020 14:45:02 +0200 Message-Id: <20201012124506.3406909-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com> References: <20201012124506.3406909-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 The PCI_ADDR() macro use generic PCI fields shifted by 8-bit. Rewrite it extracting the shift operation one layer. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Michael S. Tsirkin --- hw/pci-host/bonito.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index a99eced0657..abb3ee86769 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -196,8 +196,8 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1) #define PCI_IDSEL_VIA686B (1 << PCI_IDSEL_VIA686B_BIT) =20 #define PCI_ADDR(busno , devno , funno , regno) \ - ((((busno) << 16) & 0xff0000) + (((devno) << 11) & 0xf800) + \ - (((funno) << 8) & 0x700) + (regno)) + ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \ + (((funno) & 0x7) << 8) + (regno)) =20 typedef struct BonitoState BonitoState; =20 --=20 2.26.2 From nobody Fri Apr 19 16:11:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602506726; cv=none; d=zohomail.com; s=zohoarc; b=LuQ02CehCxk7MxTY6VdDiTJHOvCbG/YvIXtFxJkjLtiHjtuMZ/G0RtqslnILHSTI4ABq8uuXR46yta9vZS1paWFljfD7wgJeahB/YFwlNfA8QZCaElbJU0RN70TUjQWYckwfgZld0xudh6xx6Ah20UyQiOfMGWbEfDyBGHK+CeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602506726; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=uEfJTmQm7IfbaNLnhhKiUk3mZKxHaYrO9aWEgNYf1LY=; b=ObLyNbZ+OG8y5CjHhxnFb3OAIqLtgt81aGq27n1WCbKl96PN/lvZ4wnjG5N4B14UTp69Lk+gBPBHTXcZ/L/+5nSWb25Gslt+QCvH6tVmqWClruOQ3lftlA8whv/iYqc9OK48pTDq3mp2dD/6WH3zcwWcf7lPvie/dOV5mTRJpdg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1602506726615913.550816577611; Mon, 12 Oct 2020 05:45:26 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-TSWEYvGjMJeFHn4kBtaG3A-1; Mon, 12 Oct 2020 08:45:22 -0400 Received: by mail-wr1-f69.google.com with SMTP id t3so2761639wrq.2 for ; Mon, 12 Oct 2020 05:45:21 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id b5sm2564766wrs.97.2020.10.12.05.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uEfJTmQm7IfbaNLnhhKiUk3mZKxHaYrO9aWEgNYf1LY=; b=i6qZgCEQ875udRWEeba6AQZW5gTzAMKjtYhajRPEjKMQ4u3b6eTEJp/VWh4k9e3Mr6ap39 86oVu9j4naArs7/i20TvK4KRyKXXclSczvdeDyuFAFdzzMVMH+o9Ay0NGV0sNHerO20VZV qng19FfoUj02qLtBJW8Na7otXYahs0I= X-MC-Unique: TSWEYvGjMJeFHn4kBtaG3A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uEfJTmQm7IfbaNLnhhKiUk3mZKxHaYrO9aWEgNYf1LY=; b=UXECjdtn3qaYN9HUQn6FZj+TxquKZo5LogSRMvOLl7fn8NS0F9E2iI8hPLK9GVhV8a IOMIIulWSDRDJWaDVaeoTHlIrhfrw+Io/SZuA1CHF6u6OZoEZAlxFIInXfTfdLVVkD31 6FiU4ZtssrF4Nnc5aBSziKUXqcdtSC51T2XZpe4fbn0ZtCMW7iQP5/1MEDx7H4JFKtpb 5tAkYURkyyI3F15K3l6+gAmHj7MGK5DaYXFCrgBJFoo/upcwMZFHrDtzMDVB0IW11ouS 9ut25KMUOThUXgiofuiKXbWZ5iNljLMM9AVyDzPdt2SobWlk54H13Fngphfq3LqtLOog Pvzw== X-Gm-Message-State: AOAM533sjmecvd7m5KqoF6VzPUGiqxgvtaQ9UcU9xA45O9IL3XbbjpzQ CZktOruc+I+HtutBU3zg/3hMUQmmMkMFjBl9n6LQZ2A1Akg9g9eBVPoMCCf7H6qYqe7SIkuEvMr zvmBkrb5VgGhkBQ== X-Received: by 2002:adf:8b85:: with SMTP id o5mr16319170wra.104.1602506720840; Mon, 12 Oct 2020 05:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUet7a3+icknkdXIUBYsqHO/fz4MbL6X5ByiZqEc6CjjMuhyc0L0IjJS+YtIXZM/ET90duwQ== X-Received: by 2002:adf:8b85:: with SMTP id o5mr16319151wra.104.1602506720677; Mon, 12 Oct 2020 05:45:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Paul Durrant , Aurelien Jarno , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Jiaxun Yang , Yoshinori Sato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Stefano Stabellini , Helge Deller , Anthony Perard , Richard Henderson , Aleksandar Markovic , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Marcel Apfelbaum , Mark Cave-Ayland , Paolo Bonzini , Huacai Chen Subject: [PATCH 2/5] hw/pci-host: Use the PCI_BUILD_BDF() macro from 'hw/pci/pci.h' Date: Mon, 12 Oct 2020 14:45:03 +0200 Message-Id: <20201012124506.3406909-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com> References: <20201012124506.3406909-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 We already have a generic PCI_BUILD_BDF() macro in "hw/pci/pci.h" to pack these values, use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Acked-by: Michael S. Tsirkin --- hw/pci-host/bonito.c | 3 +-- hw/pci-host/pnv_phb4.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index abb3ee86769..b05295639a6 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -196,8 +196,7 @@ FIELD(BONGENCFG, PCIQUEUE, 12, 1) #define PCI_IDSEL_VIA686B (1 << PCI_IDSEL_VIA686B_BIT) =20 #define PCI_ADDR(busno , devno , funno , regno) \ - ((((busno) << 8) & 0xff00) + (((devno) << 3) & 0xf8) + \ - (((funno) & 0x7) << 8) + (regno)) + ((PCI_BUILD_BDF(busno, PCI_DEVFN(devno , funno)) << 8) + (regno)) =20 typedef struct BonitoState BonitoState; =20 diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 03daf40a237..6328e985f81 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -889,7 +889,7 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds) /* Read RTE */ bus_num =3D pci_bus_num(ds->bus); addr =3D rtt & PHB_RTT_BASE_ADDRESS_MASK; - addr +=3D 2 * ((bus_num << 8) | ds->devfn); + addr +=3D 2 * PCI_BUILD_BDF(bus_num, ds->devfn); if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) { phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr); /* Set error bits ? fence ? ... */ --=20 2.26.2 From nobody Fri Apr 19 16:11:42 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602506747; cv=none; d=zohomail.com; s=zohoarc; b=i0XSil1VsYskrQk26TWucQ2GZ8SzDifHhuiwzWRDDs8hqvmEcjI3bapH+BFWgJgzLzWokgzQ3gO4Cmz2PrWeUfcKcruBYaTZ74Msek6igsoaBfrEaR9Zptolyc5US+WBUJrTCkBYKzESK+bgRmj89Cajs945K76ZFQpnVJUW2Xg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602506747; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=afTxi5eJGUK9TCxtbNIddaNUCDX7pFC3c3DvHTcAqpY=; b=lUDdhoRoaUutO/bCKn0AF4aRPtnvWz3jfDVhAj1bzMhPEdmyo8V2m8IKUOuHSQBWqOIYvExVs9uP8Scnmuh5JC4pR5NuLj53NTYfBNeyB7YT6sSn91X6O8LeWT3IOHD+filGd5K4F8+TwKqweTGfJohScY1FEz2HKL89bC/Qh5I= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602506746997297.5925746086615; Mon, 12 Oct 2020 05:45:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.5927.15411 (Exim 4.92) (envelope-from ) id 1kRxCm-0002lW-K9; Mon, 12 Oct 2020 12:45:32 +0000 Received: by outflank-mailman (output) from mailman id 5927.15411; Mon, 12 Oct 2020 12:45:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCm-0002lN-Gi; Mon, 12 Oct 2020 12:45:32 +0000 Received: by outflank-mailman (input) for mailman id 5927; Mon, 12 Oct 2020 12:45:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCl-0002kr-Us for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:31 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id e9d0eca7-a567-4ea2-b67c-45a220f9f8aa; Mon, 12 Oct 2020 12:45:31 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301-8UvaL3I4NoeFMoWYH2yU_A-1; Mon, 12 Oct 2020 08:45:27 -0400 Received: by mail-wr1-f69.google.com with SMTP id q15so428804wrw.8 for ; Mon, 12 Oct 2020 05:45:27 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id d2sm14916896wrq.34.2020.10.12.05.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:25 -0700 (PDT) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCl-0002kr-Us for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:31 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id e9d0eca7-a567-4ea2-b67c-45a220f9f8aa; Mon, 12 Oct 2020 12:45:31 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301-8UvaL3I4NoeFMoWYH2yU_A-1; Mon, 12 Oct 2020 08:45:27 -0400 Received: by mail-wr1-f69.google.com with SMTP id q15so428804wrw.8 for ; Mon, 12 Oct 2020 05:45:27 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id d2sm14916896wrq.34.2020.10.12.05.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:25 -0700 (PDT) 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: e9d0eca7-a567-4ea2-b67c-45a220f9f8aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=afTxi5eJGUK9TCxtbNIddaNUCDX7pFC3c3DvHTcAqpY=; b=J9B7H7LrBwwINvhmbA0l+GyBcrAWdBztzvrutX5qL9WpBHgXY5E3f50Ir4hPrPx7EdgzIn kR4x/qEi2is+WKZzD/VYzwSh6LAbviPzQByxNB409OF7AU6CG3ut1GZi4KTvieb3f//Fg0 EhfteZwtpEqiSFfOuc1YT8KEBIDC8Po= X-MC-Unique: 8UvaL3I4NoeFMoWYH2yU_A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=afTxi5eJGUK9TCxtbNIddaNUCDX7pFC3c3DvHTcAqpY=; b=SGEzAkeueYgh1Hdl9rnkhIP18i9616ASlF36+VdljJtVtzRVAUQ3a/RPKQ5Su7hc5a +ujUMfIsvgEfW2HDoie/XHyMufSRNfkuFwWljUXgF3By+kbakcgePCW42VhrrpLIXgUN qHRy6Urn2i3HTQf9xPnD62CJlKzg6wMGLO82BXSJBlvsYl1Vj0eezxu2iaCp3Bcu8MN+ sezXXycjRWhAtXx3SHF+BwG4gago6CTIpXz90pelp7CELxjRXvMOWZdyhHU5q+ULUjFN prlh7pyoWv5FQo3aA+hvzCyXL4XLTrfA6l+DiW6sT+yRTo1uSChDP6PxfvEM/7epXnDl OL8w== X-Gm-Message-State: AOAM531xFIwIiXpe8mxKCUapgmDLG7TN69MqAvVW3a3P22eTG3XJD6Ny FzfJP92lltqux3nVk2OyyNaHvIsYX5DkJorPLtZ/9hNZT2ci9Egn8nREPnk8eHm7e/l3gOu+EWt H9wYRfd8fr1mQcN7xSMLJ3EBVBt8= X-Received: by 2002:adf:df03:: with SMTP id y3mr10299478wrl.70.1602506726315; Mon, 12 Oct 2020 05:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpp+5kB0ZYqB04uT+WIG2a4k9Wmj2oRtvHubS3HvdSiiZu7CRJnV3hLF0c9e7ixdPrjPJpoQ== X-Received: by 2002:adf:df03:: with SMTP id y3mr10299453wrl.70.1602506726102; Mon, 12 Oct 2020 05:45:26 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Paul Durrant , Aurelien Jarno , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Jiaxun Yang , Yoshinori Sato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Stefano Stabellini , Helge Deller , Anthony Perard , Richard Henderson , Aleksandar Markovic , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Marcel Apfelbaum , Mark Cave-Ayland , Paolo Bonzini , Huacai Chen Subject: [PATCH 3/5] hw/pci-host/uninorth: Use the PCI_FUNC() macro from 'hw/pci/pci.h' Date: Mon, 12 Oct 2020 14:45:04 +0200 Message-Id: <20201012124506.3406909-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com> References: <20201012124506.3406909-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 We already have a generic PCI_FUNC() macro in "hw/pci/pci.h" to extract the PCI function identifier, use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Acked-by: Michael S. Tsirkin --- hw/pci-host/uninorth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index 1ed1072eeb5..c21de0ab805 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -65,7 +65,7 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32_= t addr) if (slot =3D=3D 32) { slot =3D -1; /* XXX: should this be 0? */ } - func =3D (reg >> 8) & 7; + func =3D PCI_FUNC(reg >> 8); =20 /* ... and then convert them to x86 format */ /* config pointer */ --=20 2.26.2 From nobody Fri Apr 19 16:11:42 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602506751; cv=none; d=zohomail.com; s=zohoarc; b=LowiIyk/2trIq19h+TESVKfHCWW6kd7wcpN+V43epfW1g5rTrb/l3Bish6LBaPDAJinCSX+n+giD1LKeIaZnJDAYJRoWWczo1u560BOqrjZFVdRpHTLobTkhF0JKJzvxsVNwyuxTFCnaMXaCGKWuNkPwEMxS7qmK2PDeJ6uU9y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602506751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xCNLhoelsRO4TCaFqCkPA59+Ay48720LqdAdNtyWtdc=; b=VemxZSnxm4KK/3S2hsi3Rw/ko005t3i0PyBYBmahzsS5UKLEx3kbqwMSvDDfEnSzy39dmA4h4XZnV5dkVfKDDD4LloWrq8A+SzvPN3AHUf/a6pvHpwmHDUBwxCVIjeUDF5eOesc6dAuSwRor+mntXGkpIkyC1v1oDju3QzN4HCU= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602506751600891.5645273997372; Mon, 12 Oct 2020 05:45:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.5928.15423 (Exim 4.92) (envelope-from ) id 1kRxCq-0002r0-Ts; Mon, 12 Oct 2020 12:45:36 +0000 Received: by outflank-mailman (output) from mailman id 5928.15423; Mon, 12 Oct 2020 12:45:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCq-0002qq-Pm; Mon, 12 Oct 2020 12:45:36 +0000 Received: by outflank-mailman (input) for mailman id 5928; Mon, 12 Oct 2020 12:45:35 +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 1kRxCp-0002pc-LV for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:35 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 28a554d5-2d99-49f4-ae34-aaae167cf750; Mon, 12 Oct 2020 12:45:34 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-6YnS7GlHPC2C_PRw3qm4hA-1; Mon, 12 Oct 2020 08:45:33 -0400 Received: by mail-wr1-f70.google.com with SMTP id b6so9214803wrn.17 for ; Mon, 12 Oct 2020 05:45:32 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id l5sm24326366wrq.14.2020.10.12.05.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:30 -0700 (PDT) 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 1kRxCp-0002pc-LV for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:35 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 28a554d5-2d99-49f4-ae34-aaae167cf750; Mon, 12 Oct 2020 12:45:34 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-6YnS7GlHPC2C_PRw3qm4hA-1; Mon, 12 Oct 2020 08:45:33 -0400 Received: by mail-wr1-f70.google.com with SMTP id b6so9214803wrn.17 for ; Mon, 12 Oct 2020 05:45:32 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id l5sm24326366wrq.14.2020.10.12.05.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:30 -0700 (PDT) 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: 28a554d5-2d99-49f4-ae34-aaae167cf750 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xCNLhoelsRO4TCaFqCkPA59+Ay48720LqdAdNtyWtdc=; b=ME0qyA/3xFXlPM+JyqDYjndNjdg9M+Bi4xYmeOb4Xfq5nl7WTbN7ImIK16TkalixutE/IG fU0zzkjB89xJIysW2YrWW3sqvSeypdbCUwKyuX+QmXULvqq1JUp8+LMl6nin+xFvoOqREc 8eMRH+tkhjTdDZB0RzkDW2zUCj1F+Ao= X-MC-Unique: 6YnS7GlHPC2C_PRw3qm4hA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xCNLhoelsRO4TCaFqCkPA59+Ay48720LqdAdNtyWtdc=; b=SFpshbcfaP6Ru/vTp5JlU5rrx8iIBmStk6UUmR7I7Hdk2R85ELYg13kRVszXAHQLga 4R+VzZmQ3xHkbW8EA3+Ot5CyTF1rRb0CdKn3ZMvbJKIGcVn48gRf0cYeTGRuK6VpZN+5 wdluBdIA4+CHK+qciy2S2TzkRVxAeeudW6/2azZlwj2KcoGXBjFx0b+l/qvQiM6dwpCK mgU2qHvYTI6U0Fmr/7a8QhCPo1GXFwI38dVgFB08TDA0lZzHW0P57FwqJjoDSC5pbUsz vKr7axonXn0u625wYEzQ31p2WMzijHEjV2ujpzcXjxkScXpFjxH8F3et5xBanLxAO13D Cq6Q== X-Gm-Message-State: AOAM531QuKtrSV3VTIQ7jG0tE4PULsrASPETYAy6dwEaJUdYQSh1uOtz FGSF8BsLTJCuSSsMty/WKwaPxybCQB1KVZkxLL7vAlofB8Gr+Ki4L7nG9haZdo+NBp68ZLQMkep RK4rEF+vEuhh50wAn/tWUJ27KOsg= X-Received: by 2002:a5d:4409:: with SMTP id z9mr29211373wrq.236.1602506731773; Mon, 12 Oct 2020 05:45:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxae6z034MmpPgmdTflq+mg0CAWtLHwAeKxZKoPrU70udcFRiLBlXGhJ+sn9Ujlq9DXSzSzbg== X-Received: by 2002:a5d:4409:: with SMTP id z9mr29211331wrq.236.1602506731500; Mon, 12 Oct 2020 05:45:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Paul Durrant , Aurelien Jarno , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Jiaxun Yang , Yoshinori Sato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Stefano Stabellini , Helge Deller , Anthony Perard , Richard Henderson , Aleksandar Markovic , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Marcel Apfelbaum , Mark Cave-Ayland , Paolo Bonzini , Huacai Chen Subject: [PATCH 4/5] hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' Date: Mon, 12 Oct 2020 14:45:05 +0200 Message-Id: <20201012124506.3406909-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com> References: <20201012124506.3406909-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 We already have a generic PCI_SLOT() macro in "hw/pci/pci.h" to extract the PCI slot identifier, use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Acked-by: Michael S. Tsirkin Acked-by: Paul Durrant --- hw/hppa/dino.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/isa/piix3.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/pci-host/bonito.c | 2 +- hw/pci-host/ppce500.c | 2 +- hw/ppc/ppc4xx_pci.c | 2 +- hw/sh4/sh_pci.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c index 81053b5fb64..5b82c9440d1 100644 --- a/hw/hppa/dino.c +++ b/hw/hppa/dino.c @@ -496,7 +496,7 @@ static void dino_set_irq(void *opaque, int irq, int lev= el) =20 static int dino_pci_map_irq(PCIDevice *d, int irq_num) { - int slot =3D d->devfn >> 3; + int slot =3D PCI_SLOT(d->devfn); =20 assert(irq_num >=3D 0 && irq_num <=3D 3); =20 diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index f3ababf33b6..276254e6ca9 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -140,7 +140,7 @@ typedef struct XenIOState { =20 int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) { - return irq_num + ((pci_dev->devfn >> 3) << 2); + return irq_num + (PCI_SLOT(pci_dev->devfn) << 2); } =20 void xen_piix3_set_irq(void *opaque, int irq_num, int level) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 587850b8881..f46ccae25cf 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -361,7 +361,7 @@ type_init(piix3_register_types) static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) { int slot_addend; - slot_addend =3D (pci_dev->devfn >> 3) - 1; + slot_addend =3D PCI_SLOT(pci_dev->devfn) - 1; return (pci_intx + slot_addend) & 3; } =20 diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index e091bc4ed55..588e6f99301 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -982,7 +982,7 @@ static int gt64120_pci_map_irq(PCIDevice *pci_dev, int = irq_num) { int slot; =20 - slot =3D (pci_dev->devfn >> 3); + slot =3D PCI_SLOT(pci_dev->devfn); =20 switch (slot) { /* PIIX4 USB */ diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index b05295639a6..ee8b193e15b 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -570,7 +570,7 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int i= rq_num) { int slot; =20 - slot =3D (pci_dev->devfn >> 3); + slot =3D PCI_SLOT(pci_dev->devfn); =20 switch (slot) { case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC= 97 */ diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index 9517aab913e..5ad1424b31a 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -342,7 +342,7 @@ static const MemoryRegionOps e500_pci_reg_ops =3D { =20 static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin) { - int devno =3D pci_dev->devfn >> 3; + int devno =3D PCI_SLOT(pci_dev->devfn); int ret; =20 ret =3D ppce500_pci_map_irq_slot(devno, pin); diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index 28724c06f88..e8789f64e80 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -243,7 +243,7 @@ static void ppc4xx_pci_reset(void *opaque) * may need further refactoring for other boards. */ static int ppc4xx_pci_map_irq(PCIDevice *pci_dev, int irq_num) { - int slot =3D pci_dev->devfn >> 3; + int slot =3D PCI_SLOT(pci_dev->devfn); =20 trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot); =20 diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c index 73d2d0bccb0..734892f47c7 100644 --- a/hw/sh4/sh_pci.c +++ b/hw/sh4/sh_pci.c @@ -109,7 +109,7 @@ static const MemoryRegionOps sh_pci_reg_ops =3D { =20 static int sh_pci_map_irq(PCIDevice *d, int irq_num) { - return (d->devfn >> 3); + return PCI_SLOT(d->devfn); } =20 static void sh_pci_set_irq(void *opaque, int irq_num, int level) --=20 2.26.2 From nobody Fri Apr 19 16:11:42 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602506756; cv=none; d=zohomail.com; s=zohoarc; b=mYG9cRWfBNHZLXv5rWfzZ2dvZoZE1TniVnaOmQyP9JpI8D7BkzEw6+DgcYOfHE5puebdgWtvZg2U3P3f2P/0rY/LvoXZYXbpyoG/+KWV8/C4D8UBJNU7ofmukAO8tjpBLJGts42z21AmbpSYBHlXq0qqOtQjf1KBWdKumcg8SYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602506756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9wGxJZcsEOLAGSmgs7p8pt5WGBHmly5siKydoVe/oZE=; b=C1vwgzizp/7uIsIAkYO16XYutyIyFPXHxbzfGQMQ8Fw/g3ErsTM9XvJg2Uw9jk2UZZaEFR17ehqMUEJ92izuqehsO8E2F89lWTmvzjlo/9mDiKQU3kp4LNZac3eBAOxWdFf1n5xKYcPoHeF9nHXN8jfzFdzF3S7dJKhq1P5/lss= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1602506756634740.6131521343179; Mon, 12 Oct 2020 05:45:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.5929.15435 (Exim 4.92) (envelope-from ) id 1kRxCy-0002yN-6E; Mon, 12 Oct 2020 12:45:44 +0000 Received: by outflank-mailman (output) from mailman id 5929.15435; Mon, 12 Oct 2020 12:45:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCy-0002yF-2P; Mon, 12 Oct 2020 12:45:44 +0000 Received: by outflank-mailman (input) for mailman id 5929; Mon, 12 Oct 2020 12:45:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCw-0002x4-Mb for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:42 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id a2a73f4a-121b-4786-8d31-62151f37af06; Mon, 12 Oct 2020 12:45:42 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-8aCFu4Q9NpWinpC_cbR2fQ-1; Mon, 12 Oct 2020 08:45:38 -0400 Received: by mail-wr1-f70.google.com with SMTP id t17so9288654wrm.13 for ; Mon, 12 Oct 2020 05:45:38 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id s185sm22765462wmf.3.2020.10.12.05.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:36 -0700 (PDT) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kRxCw-0002x4-Mb for xen-devel@lists.xenproject.org; Mon, 12 Oct 2020 12:45:42 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id a2a73f4a-121b-4786-8d31-62151f37af06; Mon, 12 Oct 2020 12:45:42 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-8aCFu4Q9NpWinpC_cbR2fQ-1; Mon, 12 Oct 2020 08:45:38 -0400 Received: by mail-wr1-f70.google.com with SMTP id t17so9288654wrm.13 for ; Mon, 12 Oct 2020 05:45:38 -0700 (PDT) Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id s185sm22765462wmf.3.2020.10.12.05.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 05:45:36 -0700 (PDT) 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: a2a73f4a-121b-4786-8d31-62151f37af06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wGxJZcsEOLAGSmgs7p8pt5WGBHmly5siKydoVe/oZE=; b=GyWb5H/fZm06bwgGygqA8wvOijWLElMPBbR3NwJ7MLmx63LYrinMLPua+m/FnGVnPL29jF 37CsQ6wuDBa2UT6F3b4hRP8EfWmenc9qT/SKwiv4+WcEPkHAPt5lNUE4zsJryZAhMFQDj1 U4E54cSQn7bYPDr/7M59NoPKFMPkbOo= X-MC-Unique: 8aCFu4Q9NpWinpC_cbR2fQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9wGxJZcsEOLAGSmgs7p8pt5WGBHmly5siKydoVe/oZE=; b=mB+0nT7k7KUi7qtdGb1Kr1uSuYSyIn8zdocxrTLwMLprOrMhNZAUrTPdPREHM27/jL 9Luv3by5FgdcWqdDGj1hhCubsjoZ8cIk2TbOPXBdi7ob8FF0lFnHaEYJkq9W3/rYMHMq N64/wGOBMWMrApkfUGbtbUPFj/jjheDyQWOYbfV0P+W2S9bqa6afDkyXj1CHMZgEUQMu xyZx55bKG5OSusFonVeNGTgtxEx98DV+li9fJnrrFCnwRcTmngRXApLjopkffoAWCoj+ aEibFrEIdW2ufFaou1opuch50Y5PR3nYSj2YpKms3Q8HsbXpHjyyYxN7XvlqZMruVDGK lcaQ== X-Gm-Message-State: AOAM531eQdYhKKNi5MgeQYX6y70az+WIi40PzftcFxSFH9KO0mnkWokQ qIG6Q2pz+/WO8zUY2ObnYUIcNcZpSHvKy5V11/OLnyaSq2nyrJMc9wftYGFh76IRFINg+HI0L4i /EfTPc/bTEIBHutf1DDsqb3ShwVQ= X-Received: by 2002:adf:dccc:: with SMTP id x12mr30544384wrm.241.1602506737182; Mon, 12 Oct 2020 05:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGju9pLDMIkjylp5prt4ukBOzX2jmiDpK+NGjR15EPrzwXN0JDbAFCeWH5hcu15IBYdHhmBg== X-Received: by 2002:adf:dccc:: with SMTP id x12mr30544349wrm.241.1602506736967; Mon, 12 Oct 2020 05:45:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Paul Durrant , Aurelien Jarno , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Eduardo Habkost , Jiaxun Yang , Yoshinori Sato , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Stefano Stabellini , Helge Deller , Anthony Perard , Richard Henderson , Aleksandar Markovic , xen-devel@lists.xenproject.org, Aleksandar Rikalo , Marcel Apfelbaum , Mark Cave-Ayland , Paolo Bonzini , Huacai Chen Subject: [PATCH 5/5] hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h' Date: Mon, 12 Oct 2020 14:45:06 +0200 Message-Id: <20201012124506.3406909-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012124506.3406909-1-philmd@redhat.com> References: <20201012124506.3406909-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 We already have a generic PCI_DEVFN() macro in "hw/pci/pci.h" to pack the PCI slot/function identifiers, use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Acked-by: Michael S. Tsirkin --- hw/arm/virt.c | 3 ++- hw/pci-host/uninorth.c | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e465a988d68..f601ef0798c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1144,7 +1144,8 @@ static void create_pcie_irq_map(const VirtMachineStat= e *vms, full_irq_map, sizeof(full_irq_map)); =20 qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupt-map-mask", - 0x1800, 0, 0, /* devfn (PCI_SLOT(3)) */ + cpu_to_be16(PCI_DEVFN(3, 0)), /* Slot 3 */ + 0, 0, 0x7 /* PCI irq */); } =20 diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index c21de0ab805..f73d452bdce 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -70,10 +70,8 @@ static uint32_t unin_get_config_reg(uint32_t reg, uint32= _t addr) /* ... and then convert them to x86 format */ /* config pointer */ retval =3D (reg & (0xff - 7)) | (addr & 7); - /* slot */ - retval |=3D slot << 11; - /* fn */ - retval |=3D func << 8; + /* slot, fn */ + retval |=3D PCI_DEVFN(slot, func) << 8; } =20 trace_unin_get_config_reg(reg, addr, retval); --=20 2.26.2