From nobody Sun Nov 24 20:21:11 2024 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=1721020881; cv=none; d=zohomail.com; s=zohoarc; b=jZ3vIJldvjfa9FJnYX1Y8nJ6OZ4flumk7ggXu+bRldcSRCI/ja/gs0LVsUcNoo2h3jZMhBzcjuiwElkUkoIdE7LHoCWgeE3OtMgrNRRau26OJHnjV+3PUjU0itpmr2Caq9qq1X4148K6OY3HQsoiqsSsrztm1pn0LB+Baygo1dM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721020881; 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=ZZGRu8v6oxuF32W/xrA/69BjX55/YFUQg7PXZsmlE7o=; b=SXd/5aUWdoB1xAncbcNywflLTlQ3pGcIK/GrkHJiTzQeTYjY9ZoiWyhtsp/zKeElMPjqQXfWbxg5wR+0jDsLuREFhWAn8E8+xyOSgWFAmlSSkjQFSgoBlZiRgfS7IPqxOWq20qW3x/T9efDmyHhAivFCvm0YKbcCqsHCmSGRjnw= 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 1721020881708599.6697890223309; Sun, 14 Jul 2024 22:21:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTE8V-0001K7-NL; Mon, 15 Jul 2024 01:20:31 -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 1sTE8Q-0000gJ-DL for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:20:26 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTE7y-0007Rw-8R for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:20:10 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70b07bdbfbcso3599032b3a.0 for ; Sun, 14 Jul 2024 22:19:54 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-70b7ecd362dsm3394705b3a.215.2024.07.14.22.19.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jul 2024 22:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721020793; x=1721625593; 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=ZZGRu8v6oxuF32W/xrA/69BjX55/YFUQg7PXZsmlE7o=; b=Ak4EJU3VSqk1eCVWAUb0+PbMC+ctopGi9UG+dTE0YWMpwdVHFLnlfC2w1mSPB/muIc zcYrSV2TAyLC0dpFHTvAnrHbSsZbsziJfENZJ0OmMxFxmM4ecp+z16BN8gJCroJKr2bA 02LTDoVZjqJ1J2tJ2e2baQ2ZCpR5YxNf26QRf5FoCrlgoKT1tNVqPXmaw3EBuH8PppGy tZdi3T8/FIkmyBolzREeptdG3LCZrVHN0s2xAlodNcE/n5mSSs4Z24H5BY/Rfs9MUPT8 ysi8N4WOatshT/uZU6PeTDv44rL0HS0agx/tsMzjJQq0L7NiqGEXFro4WvYYYGmtiW0y fz4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721020793; x=1721625593; 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=ZZGRu8v6oxuF32W/xrA/69BjX55/YFUQg7PXZsmlE7o=; b=lGe5tmhlbV8KtefONo+v460mdQ52ZDaHPF/5UUICkKRkEXALcLGFVanOj47nhG7vCe l22mbbbWTV3CrWS99C+6yfHBW1LEE67VRiTyAkBM8iIixIQKaKHEKbGULWSaouhQD3z1 ZaK5ryWdIwiE7U1Vnbw5s8Sq9h24V+rcN127hKY472eD6S7ZOFn4QH89PWr/Dp1ki69Y BDg+tAfm1rD5aw/c/nRBPNQGjxpE2ydHZsZX8+eozqT+SmCheHJpKr8glSrkGR9FVlHk Lo5EJ+5gsReT0TApIxlwgaiu4NjHUD0Ii9SjzPrt/DMZ/a3DKwqeU9ika8NISvyENwNo xraA== X-Gm-Message-State: AOJu0YwlnszXhyqSTeN7arfWWEVDBoXzJW1Cx0mpqRG7Wp1XHCRRHsRY r7CFZilVMweJwtKrwTTK+DLC1QQ/ySgJ2s1ZL0T7NG32uBE6iAfsa0dfgX395r8= X-Google-Smtp-Source: AGHT+IG4YjG0ntIffx9f8EzYgy5fvK5gEa4orev9+ojliP35f+0nuEj+8HiWLZO6H79kpdfZStR7vA== X-Received: by 2002:a05:6a20:cfa9:b0:1c2:8d1b:2776 with SMTP id adf61e73a8af0-1c3bed16a76mr12920506637.20.1721020793302; Sun, 14 Jul 2024 22:19:53 -0700 (PDT) From: Akihiko Odaki Date: Mon, 15 Jul 2024 14:19:09 +0900 Subject: [PATCH v5 3/8] 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: <20240715-sriov-v5-3-3f5539093ffc@daynix.com> References: <20240715-sriov-v5-0-3f5539093ffc@daynix.com> In-Reply-To: <20240715-sriov-v5-0-3f5539093ffc@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 Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Yui Washizu , Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 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: none client-ip=2607:f8b0:4864:20::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.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, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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: 1721020882378116600 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 56523ab4e833..ec8fc0757b92 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) { uint16_t ari_cap =3D pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); uint16_t first_vf_devfn =3D dev->devfn + vf_offset; --=20 2.45.2