From nobody Fri Apr 4 21:32:31 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1741932971; cv=none; d=zohomail.com; s=zohoarc; b=DcmxE6Kdtl9ZpZVmIzHBFX8PS0rZWJ2HCeTaPaWAj2Iq4wSGa+oCNlNG4CMfN3eTgxWXOtScIS2c7csc0sb5T4tv2AolIFX9of4hSKXp/+9/WYjmZIOnEt8+9XobtbrOHv5u06Qf53/ajFZjOFW7wt8lwKjzf16hN1UCyBcdWtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741932971; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PBq5rAr4J4hH2t8yEZvrT03kQi3atZwMbOmf5i2HDzE=; b=AhF4o3JJInDaVPXSmVs/MRu6PjgiyeGPywQTAR4ZeKMYZX9WsD4SuVHAJ8xnov7TLgzxKK3TQDq3qbMqzy7lkgcowDOEmGG7aF8IN6nhToOjtmSFYge1+bpCojnBEGTaLkqYW+WaeqpjWeUNUy+LiPRCPpxEuZ8FfQg1HY3Totc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741932971725221.60163985044994; Thu, 13 Mar 2025 23:16:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tsyKy-0004kG-ET; Fri, 14 Mar 2025 02:16:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tsyKN-0004Rg-VP for qemu-devel@nongnu.org; Fri, 14 Mar 2025 02:15:28 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tsyKJ-0005Nj-4A for qemu-devel@nongnu.org; Fri, 14 Mar 2025 02:15:26 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-223594b3c6dso34790115ad.2 for ; Thu, 13 Mar 2025 23:15:21 -0700 (PDT) Received: from localhost ([157.82.205.237]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-af56e9c94cesm2262607a12.6.2025.03.13.23.15.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Mar 2025 23:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1741932920; x=1742537720; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PBq5rAr4J4hH2t8yEZvrT03kQi3atZwMbOmf5i2HDzE=; b=PS0pIuag8XyhFJppjhll2A8SB3OVs87ZqsDCXDgqHWg989ksYr13849yCMFxekN4hh 4lEYcr1hNL2xypBKelq0FFAq1NqmJtnfVn89gszr6QvXM0DfUiGFguG05P/+OIi6VZjr hw7SjEtRHLaPeUOt2qXgvCOfgODbQy63Q5abZbgbNm5fxZ3Mp3Gx4m4LZZyvam6mBC+c rWWtcQr9g/UhuXVDEweIXGye2CEFsJ212+nWRBBSvAWe2Um+VwQuMYeINEWsnLGN8fxG JMRpxu2z0Y9MN7E9MOU6erTEF/jEhqmsPSjN00jUYQHvpq23u4A0ewftHA9DK4Vqu1+1 JTPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741932920; x=1742537720; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PBq5rAr4J4hH2t8yEZvrT03kQi3atZwMbOmf5i2HDzE=; b=rt2kliL7hRWSlzYQeT2aOketKjGKpMZ5z7FTeA6LuW+JUS8VILrc0vkNwJyHtEZI7o IlBviOZ008jUN78QXOl7Q64kgJyaUnAS5Ehv4X52kRvqErm69F6FE4+M+/tZUXtZmLFD AS3BHwdQeN/VDmK/hpC2xTskET7JU4bM9J/ZbMAkHHRsuCztgSkdfKF0Y2A7d1SHtvbB +SvnDBvoIBWmUI3MzpE2px8vgcmGAaLrAFxlnawv+nYQ3VBi1ymA6TD/xgFnn1dyekgP NSujjzGhMlhXU3erlp5WEkclz9eKhXJshyde1KMpz3J2YwfpCJIlVXW0qjRNYU71KnoV CH2g== X-Gm-Message-State: AOJu0YxlMSwAb+gufY55WmmYK6GHGVUi2lTACvycXxP0gSt1+xs/T8f+ hFvhk1bOerqjMIo1cdbWdVLDlDV+i5cXUxOOT9yGe5tJbXLOKBDtJM2eyaOnEdQ= X-Gm-Gg: ASbGncs54tJKkVWQxT6Bt8HeZMB5iI8h0AgIvSjWOo9P9GkpFf4CNhMwWMeqE6pz/vD z4CoWF40zqjt/pxb5thkWjS6kEJojHEtqGAi/AK3tWf/5GMtMyrCcKTo8Y30mdJNMEAWuKUkK0K hcdHJ6mCO24vUFxwA/QvPca5f3kTWwiF5kuwH6QomUB6mGEZg5hGvtwZtr4vYyLKXVsX/p3wJDa c/wYAJLRRmF8K85c+6q40E4c73dViL9tYoGi7EpRY4ib45iAdD1XXBipzvohXh76+m6VYVzLulw SI/tmhsenjWDVgkqKHCjJKxoDEi6vG5uC4AjUQ8lsxn4WY7OdHs9aGgxO1c= X-Google-Smtp-Source: AGHT+IGY8awK5IU1ZXRfAQHGnFvTiP/np+OY2FDjZQ9ywMX79L2ShTI3Hoza2TC/FZRMz6E1Y6bHdA== X-Received: by 2002:a05:6a00:2190:b0:736:5725:59b4 with SMTP id d2e1a72fcca58-73722339c79mr1907742b3a.3.1741932919882; Thu, 13 Mar 2025 23:15:19 -0700 (PDT) From: Akihiko Odaki Date: Fri, 14 Mar 2025 15:14:52 +0900 Subject: [PATCH for-10.1 v9 3/9] pcie_sriov: Ensure PF and VF are mutually exclusive MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250314-sriov-v9-3-57dae8ae3ab5@daynix.com> References: <20250314-sriov-v9-0-57dae8ae3ab5@daynix.com> In-Reply-To: <20250314-sriov-v9-0-57dae8ae3ab5@daynix.com> To: "Michael S. Tsirkin" , Marcel Apfelbaum , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Jason Wang , Sriram Yagnaraman , Keith Busch , Klaus Jensen , Pasha Tatashin Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, devel@daynix.com, Yui Washizu , Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1741932972279019000 A device cannot be a SR-IOV PF and a VF at the same time. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 1eb4358256de..109b2ebcccba 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -42,6 +42,11 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, uint8_t *cfg =3D dev->config + offset; uint8_t *wmask; =20 + if (pci_is_vf(dev)) { + error_setg(errp, "a device cannot be a SR-IOV PF and a VF at the s= ame time"); + return false; + } + if (total_vfs && (uint32_t)devfn + (uint32_t)(total_vfs - 1) * vf_stride >=3D PCI_D= EVFN_MAX) { error_setg(errp, "VF addr overflows"); --=20 2.48.1