From nobody Mon Nov 07 21:21:29 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N5kgZ1524z4gQNC; Mon, 7 Nov 2022 21:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N5kgY5GyJz4FjH; Mon, 7 Nov 2022 21:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667856089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CPiNLU4JN/z+AOP5UuMu0OwnMBtDiVNxfRUqFuqVbME=; b=WIF+haTGjrFTvF5e0VevA6R0gprRSPkxt/RFzXP7uXUv7n8AEwMj4abZI830EVXxZFKe1b vJuSx+00ZwYVP3cMCJ36FNchP17CWuhtFlV2obWJOrbD4xOxbW7upB01k0w/Nuz6L3rK5D OqZ1ot2YAiqd2QasEdhVnAbHHnAvDR1oh+hkhVzL3ZDSaENJ9QwIkFGre3JbL7J/oA69MX U19jaCoT7HeEk47Epx3BHuA/dfuR2+Rg3DJzFCvgAmmi1aNqlT9mEjiPSteEUqbUVzjvck 11qqpaOqPovBHvPDhELir+jw5GssDOY8iyrT7UAuci7rJuIH5b7y+waX3KcpDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N5kgY3zbfzGNC; Mon, 7 Nov 2022 21:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A7LLT2r051361; Mon, 7 Nov 2022 21:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A7LLTJ7051360; Mon, 7 Nov 2022 21:21:29 GMT (envelope-from git) Date: Mon, 7 Nov 2022 21:21:29 GMT Message-Id: <202211072121.2A7LLTJ7051360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 118cfb829f35 - main - pciconf(8): Decode ACS extended capability. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 118cfb829f355a4545f079f12bab5ea8e41fe214 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667856089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CPiNLU4JN/z+AOP5UuMu0OwnMBtDiVNxfRUqFuqVbME=; b=ktxQQdeq7J04lqvcantyhAGVWfjq/FbozO4IejYXg12TFJa01CNQ9GDKVPtWRR5dr39riU XdpByO39YQkm8pogagCsFgF/68lCAy5GbKW3NYboauu3DeL0oSkqrsp50KzZXmh5SdlxGk VBzohlUTiXMhY+A53DXKdqTKyUjqOZ8sskUZg0FCU0aqtmUp+sqnDiDuA2DGRUSPmyvnuJ bJtcK3vwtsUlAjeNf0JtMT7uIlCBHmvMduVv2AICglZrq0iMU8rgG75g1nutKTbD2a+kSA 9pfiHLOnWt8JnQYEJmbGcWLHePkmxfWW3YuraLlXfzZdY9eFRQGoAVIJ9GvLIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667856089; a=rsa-sha256; cv=none; b=LRkXIt25b4jr15YI7qZ14/25yGfELBbUjqeRNi7wdqjk+dSZy8dseTfFLxeBCwVyST0DaC aN9ieckn7hgK8GAS+k00ERmQAivCRYo4g2aHbqJfgrIW5kPvRnWlBZxhmNjPZFyc8qNjqb hTLque3LV+zPg4eEjdktZWtJt+VD/rH8mE+AemADotxplKRXotE5MQBVvt4LfNGBxi6o04 W4zZdh5SzoxmJnG9rwA03rE0TJOQ3jkQU/OhmM/8sOQneNRDUC0XvaZlvfpo6DBhageDJY yXjlCm8fzugxLUCG4FwmKo+Rv6P2LhuSsJYjF51Z3AtfEIzHZA6ZLFLgc8Qgng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=118cfb829f355a4545f079f12bab5ea8e41fe214 commit 118cfb829f355a4545f079f12bab5ea8e41fe214 Author: Navdeep Parhar AuthorDate: 2022-11-04 19:30:09 +0000 Commit: Navdeep Parhar CommitDate: 2022-11-07 21:20:22 +0000 pciconf(8): Decode ACS extended capability. MFC after: 1 week Sponsored by: Chelsio Communications Reviewed by: kib@ Differential Revision: https://reviews.freebsd.org/D37271 --- usr.sbin/pciconf/cap.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index eae53acbd250..3d28fe9bc331 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -1016,6 +1016,64 @@ ecap_sriov(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) print_bar(fd, p, "iov bar ", ptr + PCIR_SRIOV_BAR(i)); } +static const char * +check_avail_and_state(u_int cap, u_int capbit, u_int ctl, u_int ctlbit) +{ + + if (cap & capbit) + return (ctl & ctlbit ? "enabled" : "disabled"); + else + return "unavailable"; +} + +static void +ecap_acs(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) +{ + uint16_t acs_cap, acs_ctl; + static const char *const acc[] = { "access enabled", "blocking enabled", + "redirect enabled", "reserved" }; + + printf("ACS %d ", ver); + if (ver != 1) { + printf("\n"); + return; + } + +#define CHECK_AVAIL_STATE(bit) \ + check_avail_and_state(acs_cap, bit, acs_ctl, bit##_ENABLE) + + acs_cap = read_config(fd, &p->pc_sel, ptr + PCIR_ACS_CAP, 2); + acs_ctl = read_config(fd, &p->pc_sel, ptr + PCIR_ACS_CTL, 2); + printf("Source Validation %s, Translation Blocking %s\n", + CHECK_AVAIL_STATE(PCIM_ACS_SOURCE_VALIDATION), + CHECK_AVAIL_STATE(PCIM_ACS_TRANSLATION_BLOCKING)); + + printf(" "); + printf("P2P Req Redirect %s, P2P Cmpl Redirect %s\n", + CHECK_AVAIL_STATE(PCIM_ACS_P2P_REQ_REDIRECT), + CHECK_AVAIL_STATE(PCIM_ACS_P2P_CMP_REDIRECT)); + printf(" "); + printf("P2P Upstream Forwarding %s, P2P Egress Control %s\n", + CHECK_AVAIL_STATE(PCIM_ACS_P2P_UPSTREAM_FORWARDING), + CHECK_AVAIL_STATE(PCIM_ACS_P2P_EGRESS_CTL)); + printf(" "); + printf("P2P Direct Translated %s, Enhanced Capability %s\n", + CHECK_AVAIL_STATE(PCIM_ACS_P2P_DIRECT_TRANSLATED), + acs_ctl & PCIM_ACS_ENHANCED_CAP ? "available" : "unavailable"); +#undef CHECK_AVAIL_STATE + + if (acs_cap & PCIM_ACS_ENHANCED_CAP) { + printf(" "); + printf("I/O Req Blocking %s, Unclaimed Req Redirect Control %s\n", + check_enabled(acs_ctl & PCIM_ACS_IO_REQ_BLOCKING_ENABLE), + check_enabled(acs_ctl & PCIM_ACS_UNCLAIMED_REQ_REDIRECT_CTL)); + printf(" "); + printf("DSP BAR %s, USP BAR %s\n", + acc[(acs_cap & PCIM_ACS_DSP_MEM_TGT_ACC_CTL) >> 8], + acc[(acs_cap & PCIM_ACS_USP_MEM_TGT_ACC_CTL) >> 10]); + } +} + static struct { uint16_t id; const char *name; @@ -1099,6 +1157,9 @@ list_ecaps(int fd, struct pci_conf *p) case PCIZ_SRIOV: ecap_sriov(fd, p, ptr, PCI_EXTCAP_VER(ecap)); break; + case PCIZ_ACS: + ecap_acs(fd, p, ptr, PCI_EXTCAP_VER(ecap)); + break; default: name = "unknown"; for (i = 0; ecap_names[i].name != NULL; i++)