Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp335992rdh; Thu, 26 Oct 2023 03:47:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYABmyKA06zXjs8utoVM3xszs/YvfPsCRGCun4h830hPirm4J1FF1701DVcNHW7I6Fnobs X-Received: by 2002:a0d:e84b:0:b0:589:8b55:f7f7 with SMTP id r72-20020a0de84b000000b005898b55f7f7mr17666504ywe.39.1698317270624; Thu, 26 Oct 2023 03:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698317270; cv=none; d=google.com; s=arc-20160816; b=F9zQkkKVoN4RXmcFI5w1p1Hh3feGlM9ubOWbl/+bmD/AEkyPYwseSB55wAPeT3vpmP DD1zekKZH/qrGNCOv5DEExlrmFC9uxCdOFLHwvhoIVgIuL3OUphkfjH25NVGeUs4FHxZ L2IGu8PiziZNRF8eJfjiWHSONOO7W1cBsNZIs4nHvbHM0IajweLq8IpFBBKOlwPjuYb9 /ZRKl0RMdFp0Frw51mtkSPaBA0FJMUAGxhYN6rE286FU9hQwULa2Xm4ANi0WyPl3CGki bn+JfOvvSjebXvs3O96mN5Qol8zCBsyJeCYZ+PbyxKJoNjenJ8syXjoslp4/IHwOZw8g feMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zARtYhe8iofTNi9oUIWhel0XKe8pA8fsGQ6TZX749AM=; fh=ninYELL08qUJE0xoU9SW14pu65t2Z/9Ewfdgr0PBdHE=; b=0p36x5NerSOlyQFXkW1khiF8pyMDcrDwFc/+9sOfxrVn+2r36PUsfUmi0zbsy/ems1 +8a3KAF+V8AiNwbw8LasQV7zSQNE1OVFHKUyxTdkHy5Ur4kx5VRYePjleP/wtHlQiKn/ pkGO/GaXlN3oT8X34Aiq1HXPeCyJ+wgU25btGRxmoTTRkrB6jkXrqSpwldr4aFt7/os/ ir4Mo9xB7r1OGdePfeEg/WyIznhHKW/MwXIadiyyETCEm7riOAJ27kjL+YxsmGE4fP+s kybdUSWZtTvtOoueZx6UBVdlHLHN7RXMDdkuvxAMF26Pkw1c+xWy6LpwR/xdOSlkT49Y DWpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h/kI//wp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s128-20020a817786000000b0059f69e618b7si14920352ywc.391.2023.10.26.03.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="h/kI//wp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E68DF821692F; Thu, 26 Oct 2023 03:47:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbjJZKrk (ORCPT + 99 others); Thu, 26 Oct 2023 06:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjJZKrj (ORCPT ); Thu, 26 Oct 2023 06:47:39 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D63B19D for ; Thu, 26 Oct 2023 03:47:35 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c5028e5b88so10048721fa.3 for ; Thu, 26 Oct 2023 03:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698317253; x=1698922053; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zARtYhe8iofTNi9oUIWhel0XKe8pA8fsGQ6TZX749AM=; b=h/kI//wpeIXTKh9Yxbd7z7B3SptYh7FLI7bpeO2DBb+ZRX50IXHgU1nuo7PyozAFma NeRc5NWVI6rJBzLdH3zERIxeaJ0m8jZzX5uILNDaENwXx3DyBL+9ZDzhcPQUO2CVU/JM l2gPXcYizmz7qS7y/kgmVqV/E4tj73kvsieo30eOHvWkKG4h11w1zQgztfEQWH61qmHi eD3/mAulkztQx1ZsgrZKmjqCERq1X1ZCeMVf5KHuEI4EFDy+Pu00qSLAsmbmXPHi89sz q9nSIDSSX2hfIVOAVYQbVynoRjvpqhcGj1iw4SYZddGBy0XcsDOIFYSUeG7oIBboVjOY DPTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698317253; x=1698922053; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zARtYhe8iofTNi9oUIWhel0XKe8pA8fsGQ6TZX749AM=; b=RN5c8tzuzLPklJ4M1+pGdo+fZZ05NNQrdTsbPrLwaOA1aYfmYPzZEQpxGCKhDf1uLS n43NnXgROWzRbEXEKO+QQczS0uNgVY57tZ7MKxfehGxe2YWD3MTNtvJ78hyKAeJpnnPm CJbnqePNLGbO2rLK5ehssH7XdOEWPKohfV+BXj4ShqFwn79WPha/eSkHRMyG9uh51lV9 15lqznb+2q7vJ0FXIbPPo/VRFdkr50Pvh0Ddw1e2+mxCumtUB3wxrkfDQxsw7Vy2bB5f K9ZMs+uc6LXWNl1cMLZN2uBMP5jMAEOmTF6wK3MXxATpRyjwKDESMJ4v/poHI4SCV70E KK1w== X-Gm-Message-State: AOJu0YyyImPxi5+HLvAeCX4sYNn1MWJ5tGRatDoqK/rgAS0jI+1jCsB1 UuI85X5tdVpSS7XBsh8kNkrl60YbNXalo1e1PRm/Lw== X-Received: by 2002:a05:651c:1038:b0:2c5:1bd9:f95c with SMTP id w24-20020a05651c103800b002c51bd9f95cmr11798854ljm.53.1698317253615; Thu, 26 Oct 2023 03:47:33 -0700 (PDT) Received: from mutt (c-9b0ee555.07-21-73746f28.bbcust.telenor.se. [85.229.14.155]) by smtp.gmail.com with ESMTPSA id t13-20020a2e8e6d000000b002c4faf47378sm2822174ljk.28.2023.10.26.03.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:47:33 -0700 (PDT) Date: Thu, 26 Oct 2023 12:47:31 +0200 From: Anders Roxell To: Bjorn Helgaas Cc: D Scott Phillips , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Len Brown , Darren Hart , patches@amperecomputing.com, sfr@canb.auug.org.au, linux-next@vger.kernel.org Subject: Re: [PATCH v2 2/2] PCI: hotplug: Add extension driver for Ampere Altra hotplug LED control Message-ID: <20231026104731.GA1296512@mutt> References: <86ttqe4n1h.fsf@scott-ph-mail.amperecomputing.com> <20231025180627.GA1756475@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231025180627.GA1756475@bhelgaas> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 03:47:49 -0700 (PDT) On 2023-10-25 13:06, Bjorn Helgaas wrote: > On Wed, Oct 25, 2023 at 10:41:46AM -0700, D Scott Phillips wrote: > > Bjorn Helgaas writes: > > > > > On Fri, Sep 29, 2023 at 05:20:36PM -0700, D Scott Phillips wrote: > > >> On Ampere Altra, PCIe hotplug is handled through ACPI. A side interface is > > >> also present to request system firmware control of attention LEDs. Add an > > >> ACPI PCI Hotplug companion driver to support attention LED control. > > >> ... > > > > > >> + arm_smccc_smc(REQUEST, LED_CMD, led_status(status), LED_ATTENTION, > > >> + pci_domain_nr(bus) | (PCI_SLOT(root_port->devfn) << 4), 0, 0, > > > > > > pci_domain_nr() returns "int" (normally 32 bits), but since this is an > > > ACPI system, the domain comes from _SEG, which is defined to be 16 > > > bits (ACPI r6.5, sec 6.5.6). > > > > > > So it looks like ORing in the "slot << 4" clobbers the upper 12 bits > > > of _SEG. > > > > > > Is this code doing the right thing? > > > > Hi Bjorn, > > > > on these Altra platforms _SEG is limited within 0-11. I can add an `& > > 0xf` to pci_domain_nr() to make it clear that the segment number is > > encoded down into 4 bits in the smc request. > > If the following looks OK, we're all set. I put these on pci/hotplug > for v6.7, thanks! > > +static int set_attention_status(struct hotplug_slot *slot, u8 status) > +{ > + struct arm_smccc_res res; > + struct pci_bus *bus; > + struct pci_dev *root_port; > + unsigned long flags; > + u32 handle; > + int ret = 0; > + > + bus = slot->pci_slot->bus; > + root_port = pcie_find_root_port(bus->self); > + if (!root_port) > + return -ENODEV; > + > + local_irq_save(flags); > + arm_smccc_smc(HANDLE_OPEN, led_service_id[0], led_service_id[1], > + led_service_id[2], led_service_id[3], 0, 0, 0, &res); > + if (res.a0) { > + ret = -ENODEV; > + goto out; > + } > + handle = res.a1 & 0xffff0000; > + > + arm_smccc_smc(REQUEST, LED_CMD, led_status(status), LED_ATTENTION, > + PCI_SLOT(root_port->devfn) << 4 | pci_domain_nr(bus) & 0xf, > + 0, 0, handle, &res); > + if (res.a0) > + ret = -ENODEV; > + > + arm_smccc_smc(HANDLE_CLOSE, handle, 0, 0, 0, 0, 0, 0, &res); > + > + out: > + local_irq_restore(flags); > + return ret; > +} Hi, Building todays linux-next tag next-20231026 for arm64 with CONFIG_HOTPLUG_PCI_ACPI_AMPERE_ALTRA=m I see the following build error. drivers/pci/hotplug/acpiphp_ampere_altra.c: In function 'set_attention_status': drivers/pci/hotplug/acpiphp_ampere_altra.c:63:75: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] 63 | PCI_SLOT(root_port->devfn) << 4 | pci_domain_nr(bus) & 0xf, | ~~~~~~~~~~~~~~~~~~~^~~~~ include/linux/arm-smccc.h:382:44: note: in definition of macro 'arm_smccc_smc' 382 | #define arm_smccc_smc(...) __arm_smccc_smc(__VA_ARGS__, NULL) | ^~~~~~~~~~~ cc1: all warnings being treated as errors make[6]: *** [scripts/Makefile.build:243: drivers/pci/hotplug/acpiphp_ampere_altra.o] Error 1 Looks like this is the problematic patch 13ba8a09c4f6 ("PCI: hotplug: Add Ampere Altra Attention Indicator extension driver") Cheers, Anders