From patchwork Thu May 30 12:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: CLEMENT MATHIEU--DRIF X-Patchwork-Id: 13680331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AD093C27C43 for ; Thu, 30 May 2024 12:25:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCeqL-00071i-1x; Thu, 30 May 2024 08:25:17 -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 1sCeqJ-0006zN-II for qemu-devel@nongnu.org; Thu, 30 May 2024 08:25:15 -0400 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeqB-0006BP-BU for qemu-devel@nongnu.org; Thu, 30 May 2024 08:25:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1717071907; x=1748607907; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=IlN3tIaCmeHp1OLg27eH0h46h/eGp9wjTvAZbRgPYyU=; b=oSptrorolwoGgTek8BKuvxdfc0IKJs0X0r+cKi4/LPBVHmqobDEOGu+c IvzgM27U68P+ayiBAJ83qFdwz2dweohdl8wmG6lJmubXTu0GM5kxUCsqU NoTkIZL9QEPWwOXnUCSf2gkqS6uHP+pnsemP6FAlFmv2IlUJ5PYcORqvs b72+XY3QMUFS2YDu5fHWkH+sqMdpAY/AAsGk8FKGkyR/LQP3Wc+WJTt+E hTJi8NI+Sey37wm+PLJuFKHmXabbS4ujOIueko0htvIAxBRPIr8uurpW7 iMnV/3Yay+ttHkhLPZdp1Faovo/Qf14gcWp48nE/T7pKG9eW5ag7ePEwK w==; X-IronPort-AV: E=Sophos;i="6.08,201,1712613600"; d="scan'208";a="13582414" X-MGA-submission: MDGZrnJxGg9FrzMmr/4ToYpPJ800IPLC9OwFGM5b5D2xkM/tDW+tFDbdHbBwIZOaXrkla6g3UuN84/y3UkLwR1EBoVHxVPxtSIhdxQd3SKsxyesNqyJeLD1aj4lAO+3Z/R/+jWolV6/P81XEr5cL+DzwKmKgSlZfRYEdibkJegKyow== Received: from mail-he1eur01lp2051.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) ([104.47.0.51]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 14:25:02 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k97Fdj1nldz6lM+86aln4rgLSWK2boOUtVVBwl9dm+JJxAJOTGfvvgxKaOZSBFgFrSjUBGGno+D7MHvWWqOD+1y+QhB+Pgryarq+1bQg1zyf5sSmOgl1jF/632ipoRbZrSuaavaaOZBE2e5pTPCUJ0SO62fXlt2olLmsgHwopDxzQqxBxzXPU6Dmnp+irELYie+Us6U2av1VD9MMg7K8s475v4pHf1nwbOsgf4oOvjRL0V0W3k24Rh035WwNKsqTMIyKd/IYNlbG6SRmqYys9I0FJRA0h8WVXNUdTGQ6cClh1o5ybneatAejd/2xr0f4fNYTT59CEJjo/vD88be8dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IlN3tIaCmeHp1OLg27eH0h46h/eGp9wjTvAZbRgPYyU=; b=bF7+4g2jjcHfbuOdm42/K92dJrwf285oKDUzjnP6L3XwzEllvYEKNbMiy/kBKDib0fdQY9Yytq/kP+aDPDu66d73vuFt1GRPCVHLs/YWqtamkeVLsWHW+KPWKFNzKfV+sp/2X1gpcXmSNfZ7SdD2kbV7OxkKSJ9Q9NgNwZWcWoEzYhjC2nCvmTEks0VRimVJDqB4WNOJ73RqBBt0SupVtvNc23yQClSZYSDYzwrPsGO/KofpL79swd9kQ+y08+lGsfD4B+R8e/Yb/rFxOsK/n09cpJU+EjGAo1GpTjJQjqzeU07XFkwHo+nzRBbNz2KqODTpMVglx1r9hiTU1Igatw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eviden.com; dmarc=pass action=none header.from=eviden.com; dkim=pass header.d=eviden.com; arc=none Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB8069.eurprd07.prod.outlook.com (2603:10a6:20b:358::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Thu, 30 May 2024 12:25:01 +0000 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d]) by AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d%5]) with mapi id 15.20.7633.018; Thu, 30 May 2024 12:25:01 +0000 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 3/8] pcie: add a way to get the outstanding page request allocation (pri) from the config space. Thread-Topic: [PATCH v1 3/8] pcie: add a way to get the outstanding page request allocation (pri) from the config space. Thread-Index: AQHasoxkx17E2CeSRk6sKhg4F2Rw/Q== Date: Thu, 30 May 2024 12:25:01 +0000 Message-ID: <20240530122439.42888-4-clement.mathieu--drif@eviden.com> References: <20240530122439.42888-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240530122439.42888-1-clement.mathieu--drif@eviden.com> Accept-Language: en-GB, fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=eviden.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM8PR07MB7602:EE_|AS8PR07MB8069:EE_ x-ms-office365-filtering-correlation-id: 61f153da-5b18-4385-ef44-08dc80a38738 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: =?utf-8?q?UfbTOvkUlCmIPAGC83gK6t9DtP9FSxw?= =?utf-8?q?nqsnPlcDHlYUu8ICe7e4Ex9gBFd6k4kVRBNaNyAQFWZQtezWn1vAtRQh8uL/XNZXf?= =?utf-8?q?npfrZvekULYOYkTc8OmUZqk/DWtbJ1JPNFw+ktxyzOWfCBjXidmeTVNSYudVw8m7E?= =?utf-8?q?dXvGf/kwGLrpC2We7ywxRqjxDsWLXa3vggli7SMrm6L3xc2SDC3YgdK//N9zlIPIs?= =?utf-8?q?t54IM54jKCy/HfHtJClx46hK/C1gs9JbpOpaNUlox3g9zTk84dfph1TKurN0mg4z/?= =?utf-8?q?vc5hMKJFC9VOVZmVpms6OXS2LWOz7EoABhXxbGyOGPEtbGEHFzaUteXcy0Gu8QWyg?= =?utf-8?q?t2TuflP9Fp7hnr868/zIRNQcpLhLWWdoBRbcPBg4pQpc++4fcamqASrHqDhCW9lIg?= =?utf-8?q?fS7EmaqzlAXHfUztFeOP99gUHf2E5aPUo6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=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?b/p0ytNFnnbOtXP2wLLTPVC08HoS?= =?utf-8?q?PNojFhzpHbimDb2CNp2b3CGBonEViPxTsYA394iPvwEtX+2zW4hbZiTIoQRA16dOS?= =?utf-8?q?eRYceekrO3JMaJuL+dTG02S4Nte6Oti362l87+RVy8qBf+2cgTNjKiezMxYncgTw+?= =?utf-8?q?QpSydwNCc79+wOu6yepgip+XWbWr8qispt9sVhfCPjWmbZKU1G4pgGe+fcikJl/sV?= =?utf-8?q?wWZg3YT8Y9nESl7aJ83CIA6kDP6TCuvOyV5ryb5lV9xffVA075WDWrF/fM12dKutj?= =?utf-8?q?JSVtw+69+f1z4XppwcAeLwhQUNQK3lSgkv0kTzcS1mTJWguXFQfhuDZlZyofu2xU/?= =?utf-8?q?u6qiDEJ/t4VHP/tEhOrWnNha1iBH4smyyD2wOgfvF54m/5B2Rc72j0apYA2ia1CAI?= =?utf-8?q?oyDsn3FY4V2nBj2jAUl4WaxN0lJtoRqpZNoOHQqHy2eTjWl3HG4VV5ShSsEQOukEo?= =?utf-8?q?qaAgaZTZNKoVvcirX80JvAFNdDMt7TdAeC9qqmBYNe6dpBBY3eCPrDrNVa0XyBsRt?= =?utf-8?q?Ky7foSNPPUwsvBeep2p3WOiL4gNHudX/bwBSmPjiXunDCETgQdFwJHqzmsnngmaKI?= =?utf-8?q?xwU5gB94MAl5O+NL318zM8mlhlseIb0Y7ITknIYBRUb1/iLbRXRKIcues2lf8MiXA?= =?utf-8?q?5QutjOhheO7XcaaSaDj97SK2imnJxR6zqIKp5iC6gvc3pi9LhOPhojNmhsPxidxSl?= =?ut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7294D98209D060FF9792C@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: eviden.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB7602.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61f153da-5b18-4385-ef44-08dc80a38738 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 May 2024 12:25:01.5987 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7d1c7785-2d8a-437d-b842-1ed5d8fbe00a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0tmMSh24gP8rnsG51pEQvtowUUiq4IR4W+ZS6DWNyvLcdM8iAMwiw6iI5X4Lu2F93j1Q/ZwDplW6HdRzHBvZ5NACq9GqQAaKRh10RT5gY7V/HbmDqp2Gky9FmbADJkEL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8069 Received-SPF: pass client-ip=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.eviden.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Clément Mathieu--Drif --- hw/pci/pcie.c | 8 ++++++++ include/hw/pci/pcie.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 3fb6588c31..d11b11fc34 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1227,6 +1227,14 @@ void pcie_pri_init(PCIDevice *dev, uint16_t offset, uint32_t outstanding_pr_cap, dev->exp.pri_cap = offset; } +uint32_t pcie_pri_get_req_alloc(const PCIDevice *dev) +{ + if (!pcie_pri_enabled(dev)) { + return 0; + } + return pci_get_long(dev->config + dev->exp.pri_cap + PCI_PRI_ALLOC_REQ); +} + bool pcie_pri_enabled(const PCIDevice *dev) { if (!pci_is_express(dev) || !dev->exp.pri_cap) { diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index b976fd739a..7eb448148b 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -158,6 +158,7 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width, void pcie_pri_init(PCIDevice *dev, uint16_t offset, uint32_t outstanding_pr_cap, bool prg_response_pasid_req); +uint32_t pcie_pri_get_req_alloc(const PCIDevice *dev); bool pcie_pri_enabled(const PCIDevice *dev); bool pcie_pasid_enabled(const PCIDevice *dev); bool pcie_ats_enabled(const PCIDevice *dev);