From patchwork Mon Oct 12 12:45:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 271507 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=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 AC2D8C433E7 for ; Mon, 12 Oct 2020 12:51:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 121D921741 for ; Mon, 12 Oct 2020 12:51:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LoZqtaFZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 121D921741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRxIR-0003CS-3t for qemu-devel@archiver.kernel.org; Mon, 12 Oct 2020 08:51:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRxCb-0004yN-MS for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRxCZ-0008TL-92 for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:21 -0400 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= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-hoFV5ny6N6WiNJXhxgNeWQ-1; Mon, 12 Oct 2020 08:45:16 -0400 X-MC-Unique: hoFV5ny6N6WiNJXhxgNeWQ-1 Received: by mail-wm1-f71.google.com with SMTP id c204so5732218wmd.5 for ; Mon, 12 Oct 2020 05:45:16 -0700 (PDT) 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=bjYMktBwwQbsEEJhy2/x5u2H7L/kIt8z/hyR6cYl8CzNPzjXS+s8oz3S7mjlUYAyJI IL38Vfq9Sj3D9EhJxPDCQtz/jeEx92FQ7s59Ezov3eT4fTufJdPO/TF/r08Mng6kJQR2 tSwJhZ1lA0vz31JJ4ISw7wwP2GANeBIHVYJdDUufTRJ8jYpc8Fs4mT37FcsImzDt3ZPf 77x8vzCVqVh2PHGkhPTf56hSLraf6cZSHG7TRXadYJXlIEOb/CnJX8Sm5baJNWVc4mud yzKCAZ2SatBR61IRfZOnc4LZQj0JmCAzwFulh7Jhl0i3aXeRVnIhNbSkviwzZ4vMKfVz ycSQ== X-Gm-Message-State: AOAM5300lW5ywZKB6nB8IeStYgpMqbcg5NQJhT11N0XSrGkB6VFjGcmq TgSKtxE2iM6gOp1kDIu9gHyH4Wr2X6uc4bJDGF9/o5E/g87j9hQSBvOcezjGBOiEYWMNyBXfG3B BfDp0jMfAxqUhqAE= X-Received: by 2002:adf:dd46:: with SMTP id u6mr29753231wrm.295.1602506715237; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/12 02:58:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Mark Cave-Ayland , Huacai Chen , Stefano Stabellini , Yoshinori Sato , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Aleksandar Markovic , Anthony Perard , xen-devel@lists.xenproject.org, David Gibson , Aleksandar Rikalo , Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é --- 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) #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)) typedef struct BonitoState BonitoState; From patchwork Mon Oct 12 12:45:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303101 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 6ACE3C43457 for ; Mon, 12 Oct 2020 12:50:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 CE1772145D for ; Mon, 12 Oct 2020 12:50:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eLqInrcc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE1772145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRxH8-0001dq-QI for qemu-devel@archiver.kernel.org; Mon, 12 Oct 2020 08:50:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRxCi-0005FS-DU for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRxCg-0008Vv-MV for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506726; 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=eLqInrccy2QDgw0SL2TZj+s7G9Rlr3MC6t82q2/zg+uDMBjDRMIOdloT2P2M3tYOwaTaIs x7TZB3ucdYNDt4oH9UedIIURKzm8Kd8B1mDDL7Ano1ATct056PwbLiRGhj35UFMshjp+zV v6iKG6mpmOKFlMzNgU1QBmaFGcAAmBo= 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-225-M_x1QKMtMCKR4JLJ9auc4w-1; Mon, 12 Oct 2020 08:45:22 -0400 X-MC-Unique: M_x1QKMtMCKR4JLJ9auc4w-1 Received: by mail-wr1-f70.google.com with SMTP id y6so4514200wra.9 for ; Mon, 12 Oct 2020 05:45:22 -0700 (PDT) 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=WjkhQCy76EDm4ixb8bA564ieixojECFYTOpNXqN/HbhpwV1R+6rcF2vPcizeZb2vxo hfDE7CP+btzDQMWkIgLp/mT9vg10CEmpyzudbtZ8hRtbpRwIkwjkPuhQMTAY3ngh7Cky qNZM02vZr3P6z+qWwkLAttSeGnvWQTOT9FNIF5vywCjOw9MMwDJZacGD7X1tgt9HjTn8 LOFEjEbVXsVe+B4wzW9SAanhco/e7xTQ9aRnW+ViDNEQUo9Pkhr8JULmUrmEvcXBAMLc TpwElLpLxtp2yyjnOyYyOV3ecKxqtlnoSX8G0u9KfDyV6D5yCtEbMFKZcxQ0IZRJ2/L+ xtmA== X-Gm-Message-State: AOAM532pLg+j5Tp3blwFBWgnsCxVpMX4irmpRj+HuuMDCBydqhsUNjcz 8EnrWJ0vBuwC7gGVrM2PICLZgH1eA75rDrX/8d4PYPHOBcTC1BZ5IAcRQmpXsvtC9J+R5Sm9HYr iF85Mh3Q4LHRXjZw= X-Received: by 2002:adf:8b85:: with SMTP id o5mr16319184wra.104.1602506720842; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 23:52:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Mark Cave-Ayland , Huacai Chen , Stefano Stabellini , Yoshinori Sato , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Aleksandar Markovic , Anthony Perard , xen-devel@lists.xenproject.org, David Gibson , Aleksandar Rikalo , Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é Acked-by: David Gibson --- 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) #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)) typedef struct BonitoState BonitoState; 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 = pci_bus_num(ds->bus); addr = rtt & PHB_RTT_BASE_ADDRESS_MASK; - addr += 2 * ((bus_num << 8) | ds->devfn); + addr += 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 ? ... */ From patchwork Mon Oct 12 12:45:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 271508 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8CB6EC433E7 for ; Mon, 12 Oct 2020 12:48:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 0A02D208FE for ; Mon, 12 Oct 2020 12:48:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a0RIkySV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A02D208FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRxFy-0007m1-UB for qemu-devel@archiver.kernel.org; Mon, 12 Oct 2020 08:48:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRxCo-0005W1-OJ for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRxCn-00004y-1N for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506732; 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=a0RIkySVoEBjFZcRPSurxBtRLGgyWPW2IOg2lN7wUDv4q+M9gxQp6t1ArhbZLmBt9ZWl6G ygNcBHrUSNkQ8SG9OoDObl2lOkkvRBwQK0mG+JMDlY1xTcz6V6MfOJp3q2glREqmInfilQ +Pp0/W5HQBsDtmXiwUPGYX6Bzp+NMPE= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-518-i2NSvxGNNo2nNrkNKnI9rw-1; Mon, 12 Oct 2020 08:45:27 -0400 X-MC-Unique: i2NSvxGNNo2nNrkNKnI9rw-1 Received: by mail-wr1-f71.google.com with SMTP id i1so1175190wrb.18 for ; Mon, 12 Oct 2020 05:45:27 -0700 (PDT) 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=VR9Tb6qE9tCpZmbk7OJlob5c+UHVQ6NnvENcGULhZFT3pe5ctNCLTliSb1eAnxhrd2 qIJnZV7Q2Hi8vJ3JGnby9cepuL5muleOB2BjRVxH+8PTXkJf3CTuUXRWpK8D2Gth4YN6 bhqa2anp84uJpkiAmI1gIu5VCfvhbJFOgBUlKB6TKuH48/VUCbawF33mWggMkcw2P+2+ AtQq4ZN7HipKuHwAYE4puTGEUnmjD2SaOw9UgxrpT3SNzBOf9ht+ec4Ry510dgb/rJV6 P5ZpmHYooZJTRgataEuN8sljc0ll3PCJqyowuBGPt1lHaN+qfbRgcF/4hS3TI07IJQsz 7wYQ== X-Gm-Message-State: AOAM531LP7kVK5UX5XmJonAh+JbJE7G2ZjvrjSaQJYea97Ls/8SotJcv EDc5fUfIWrI6KOpqQpRR0AiikjEdmkuiSY3nYNVGmxFMGuJZh+FatWRNhfzmv5Kh0qsELJbH01w uRtNnC1MJ4IM6tDs= X-Received: by 2002:adf:df03:: with SMTP id y3mr10299492wrl.70.1602506726316; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/12 02:58:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Mark Cave-Ayland , Huacai Chen , Stefano Stabellini , Yoshinori Sato , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Aleksandar Markovic , Anthony Perard , xen-devel@lists.xenproject.org, David Gibson , Aleksandar Rikalo , Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é Acked-by: David Gibson --- 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 == 32) { slot = -1; /* XXX: should this be 0? */ } - func = (reg >> 8) & 7; + func = PCI_FUNC(reg >> 8); /* ... and then convert them to x86 format */ /* config pointer */ From patchwork Mon Oct 12 12:45:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303102 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 B1133C433E7 for ; Mon, 12 Oct 2020 12:48:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 F36D52076D for ; Mon, 12 Oct 2020 12:48:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ME0qyA/3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F36D52076D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRxFX-0007Vg-UF for qemu-devel@archiver.kernel.org; Mon, 12 Oct 2020 08:48:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRxCs-0005dv-JQ for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRxCp-00005Q-Kn for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:38 -0400 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= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-49-keh6b2YDNhC6QHEkA2uQYA-1; Mon, 12 Oct 2020 08:45:33 -0400 X-MC-Unique: keh6b2YDNhC6QHEkA2uQYA-1 Received: by mail-wr1-f71.google.com with SMTP id y6so4514394wra.9 for ; Mon, 12 Oct 2020 05:45:32 -0700 (PDT) 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=nV9JSbEwm8hWQNLk6YXEAI1N/aGPXnka2lMDiTnx77MO11SIbQeOOTxpGRt3raqYiS 7fApxuPIto+3QMoofWoJrniHn3nwpIitgbyr2YmayQqaazfVZJEQ2knG1NFPr1MX1i9D wBivWhe4S5tTAk0PR++6zU2+osjczqkqSlBhv7ZTAxYEVtjzNgrwhhU7qhFlhSm4MkoA f79oWp2uJKtAJItf14kaOzgBvUNOyanBa7S3DUnAZ8CXxYTfJJ9JnbK5c5URViQ8OxSC BDL7BaapkPAE/vNfto2b6DUY6W+PrcmVoKl2K+AomRttg56w/iv+KC4bxtozLOddLJIj rXKQ== X-Gm-Message-State: AOAM533XUpksocRp/1f35mkFeI/luSWLGKPSzxRQJ2XCyC+gpBmjHNem ysOueQ4lpcb+hJHWvXxCghXUd8v6ijJEl9+u9S+lTZ6y8TU851ePXW88LUiKh6ZkIp71cR40Lip l3JQV6QtBT+MgafU= X-Received: by 2002:a5d:4409:: with SMTP id z9mr29211364wrq.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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 23:52:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Mark Cave-Ayland , Huacai Chen , Stefano Stabellini , Yoshinori Sato , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Aleksandar Markovic , Anthony Perard , xen-devel@lists.xenproject.org, David Gibson , Aleksandar Rikalo , Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é Acked-by: Paul Durrant Acked-by: David Gibson --- 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 level) static int dino_pci_map_irq(PCIDevice *d, int irq_num) { - int slot = d->devfn >> 3; + int slot = PCI_SLOT(d->devfn); assert(irq_num >= 0 && irq_num <= 3); 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 { 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); } 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 = (pci_dev->devfn >> 3) - 1; + slot_addend = PCI_SLOT(pci_dev->devfn) - 1; return (pci_intx + slot_addend) & 3; } 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; - slot = (pci_dev->devfn >> 3); + slot = PCI_SLOT(pci_dev->devfn); 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 irq_num) { int slot; - slot = (pci_dev->devfn >> 3); + slot = PCI_SLOT(pci_dev->devfn); switch (slot) { case 5: /* FULOONG2E_VIA_SLOT, SouthBridge, IDE, USB, ACPI, AC97, MC97 */ 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 = { static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int pin) { - int devno = pci_dev->devfn >> 3; + int devno = PCI_SLOT(pci_dev->devfn); int ret; ret = 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 = pci_dev->devfn >> 3; + int slot = PCI_SLOT(pci_dev->devfn); trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot); 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 = { static int sh_pci_map_irq(PCIDevice *d, int irq_num) { - return (d->devfn >> 3); + return PCI_SLOT(d->devfn); } static void sh_pci_set_irq(void *opaque, int irq_num, int level) From patchwork Mon Oct 12 12:45:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303099 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8DBC0C433DF for ; Mon, 12 Oct 2020 12:55:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 EDF8321BE5 for ; Mon, 12 Oct 2020 12:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y7/Hgayk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDF8321BE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRxM1-0000gi-Ux for qemu-devel@archiver.kernel.org; Mon, 12 Oct 2020 08:55:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRxCx-0005n2-1D for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kRxCu-0000Ac-PQ for qemu-devel@nongnu.org; Mon, 12 Oct 2020 08:45:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602506740; 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=Y7/HgaykXGJaGQG1ddlXdHHOTOYd1wURQ8nb8ZWa64+1Rx459M+bMwX7wddfBvNj9qjxS0 Nd4g8YhzGiqJl1gR4ZxzdoQRDBc+hcXr+4kjoBSHj/HFJLgm/53tHu/4vO1Jkl+62wXf48 ZdMH6nEJ9Jveq//6sLWsQNxuZS8qO+Q= 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-579-fwcS_nsyNWOHGOu-Miv66w-1; Mon, 12 Oct 2020 08:45:38 -0400 X-MC-Unique: fwcS_nsyNWOHGOu-Miv66w-1 Received: by mail-wr1-f70.google.com with SMTP id 47so9255106wrc.19 for ; Mon, 12 Oct 2020 05:45:38 -0700 (PDT) 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=LV+yyIHfBFTaXJ9BgJagMr7z2D9XbwAjxpZIDoHoEHND6YZ5qCqhDlK5wyijCMw39I J5Ht49wDIqVfbHO/QJCWHED/4d086BnPYjgW2ciVMuZYoWKHeDQ7mGA1/tdCfk77DMa8 boQ5G8P8zp9y249cjWsN+sis0quUNiy2P055tDw0UGzvmi0LCpQLQLjljH0qf+014RuV QXly+/77Lee1MtNea94jFKLHtBVdMQkZmP7RTDodBSvScPaIn0lnXyI3A4RoHRW7rcgu MJeNvctn44N+Qvk5vuzdzJJy4a4l5SupKkH1M/wBlJJGWbOh+ZfkR+c+AL1uq8PVBRBR nPRA== X-Gm-Message-State: AOAM530/G/egoKso5hpfnh725CqXtb8+NiJwjtjiBfFZt0xvB6k4Tpja 6mwVQTQnVRsnqUd1ptPckaQQNMUWm2kUuovWlYBfE5AAxORj6RYzgA1+QWaubhT6+I4tCfX3WBf 7dC4WvdChtWNgxIk= X-Received: by 2002:adf:dccc:: with SMTP id x12mr30544388wrm.241.1602506737184; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 23:52:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Mark Cave-Ayland , Huacai Chen , Stefano Stabellini , Yoshinori Sato , qemu-trivial@nongnu.org, Helge Deller , "Michael S. Tsirkin" , Aleksandar Markovic , Anthony Perard , xen-devel@lists.xenproject.org, David Gibson , Aleksandar Rikalo , Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é Acked-by: David Gibson --- 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 VirtMachineState *vms, full_irq_map, sizeof(full_irq_map)); 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 */); } 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 = (reg & (0xff - 7)) | (addr & 7); - /* slot */ - retval |= slot << 11; - /* fn */ - retval |= func << 8; + /* slot, fn */ + retval |= PCI_DEVFN(slot, func) << 8; } trace_unin_get_config_reg(reg, addr, retval);