Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3835864ybl; Mon, 12 Aug 2019 07:12:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0RysYnzNwQMiXnxCNl6nKJnIi7nK1/cMxTWpMQqHCw4BhaTIaX8gMmTzzzZhcfhK5vXFQ X-Received: by 2002:a65:44cc:: with SMTP id g12mr29934285pgs.409.1565619139856; Mon, 12 Aug 2019 07:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565619139; cv=none; d=google.com; s=arc-20160816; b=hesHRUVs5Vf+gvGg4nPW89Y/wFrKulEv6ieAZSwu1KJOgYEyR/dN+SbTyudBMwPfkM 9/m6AmsD7vbLuzrceDa8QXC4WV+exTIeVV5/4uH8tpScQhc6i4WIq58j4fEt8BDYFX9c plaDzfmrmh/oeU+d6kbWzRd+SoOLJioW3EjtpHHLkY67Dx5FRwTkiFm+kUBb9ONXp919 C4QxtLwFNWDx6rGNBEo8EABq6UyQ9P5fBy6RyFp6yf4HqF4OW4TLnwMCcDHGZSPZ+/46 I3yYJwf+pO6ODnuipFqR5Ygi3SfBzg/RCclaudamZEG0Fb3u+Ey777dm65c2s25GqJju p1Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ImAPf5qAoKDn0lII01+6uoZ3xRG/c5SpeNPUt2AARos=; b=Nrwqvr36lWuuiM4IFEkU+VUvYXfMfBE+lV5KSOIL9S/PjSx3XG/klxk2b7KXvF7LEA NYurSFH06AaZFtYQTKbgBbvaezVAtftctls/o98tG+dMv6bOeukIRcgsy9aJu1FjA2dX Civz+Z2R7Kv4ADV72Z/c/8F+XYVqcmF2Gfo0nLYcdIiEVg40jIqAGb9hj/uKVILkKblx aF1gjL9KyiNt59F6Jyqu2oCdSCEIJrE4W2IBZQhv2PF1MoKad1kO3vDILjoIFgIkXDHj nasYGlV21qgZURQlsuhQRlZb54v9Dtvgoo/x3Hw7cnZ2OuHD+jcnckUqpcJt3VilkFS4 jDGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZoO19Qxb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si14701025ply.113.2019.08.12.07.12.03; Mon, 12 Aug 2019 07:12:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ZoO19Qxb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbfHLOLZ (ORCPT + 99 others); Mon, 12 Aug 2019 10:11:25 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41389 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbfHLOLZ (ORCPT ); Mon, 12 Aug 2019 10:11:25 -0400 Received: by mail-pg1-f193.google.com with SMTP id x15so39204161pgg.8 for ; Mon, 12 Aug 2019 07:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ImAPf5qAoKDn0lII01+6uoZ3xRG/c5SpeNPUt2AARos=; b=ZoO19QxbIJseWz0TVsYkFhTzyEIuRAAI5FFh4s6LOZdchsiJXCQjXwEWJkXC4izGpG l2WwfxYhsB1j51Ke52mdJSy+0LuSN2KBNeqGs+QtewhLmXlspMQm5wNPirkFRC5DZ/qQ /FdMY5S+ejnsh1H3XeLK110auQ6vACdXSoRdvZynYradCKGcqnDsvoSQ6hJdZxxBd8Jo VhRWas+5VMyPkxhUsdKcOjMo88wTdDXfdMMIkRomnrqVkLS8mCtdN4+nEXOt9greQtA4 noSVdOzU2tXSoz3unzRoLcjABZsiCYw5uLfhl50E7i1s1xvUU6eVAPnkvB9hBLIH988E d57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ImAPf5qAoKDn0lII01+6uoZ3xRG/c5SpeNPUt2AARos=; b=ayqj5lhVBEo39kKPga74DApFUhVC0BRJ37yxbucJgNgObcegnDUhWMkuJhL41Uzcxy +b1jiNYMtFbSlRl9zE+4Tp9vtnRoFD52X0IN6o69lQ4u4OeUaQFP+PrJzzxVBWW89CPc E2BquE2EcFf5J2c6ibdKmBuQaB/o5rBF6w+pFBUOqlAbDpf1awnFhcPw7UWLjhpas3Hy 942pl+PJTfzHqNhmFsOl71oaoJaGMCzG3xBJ9KAabeHUomH1Fg+s4YoxrckpLLomxCof 5zqMUiuWU6Twq1qmujyvlR1CqqYQyc1XjTWeoWvl2zfyr0Qn4ZqfHnVqorMC4lwewyfN BTeQ== X-Gm-Message-State: APjAAAVQMu0PmPsSiNMKp2rPLJZ6J0AxCppvD/7lIQON6z7GhURnGCDn PJbcO7+D+TkTMfe/+adRZr6VeA== X-Received: by 2002:a17:90a:ab0d:: with SMTP id m13mr22580054pjq.84.1565619084986; Mon, 12 Aug 2019 07:11:24 -0700 (PDT) Received: from [192.168.1.188] (66.29.164.166.static.utbb.net. [66.29.164.166]) by smtp.gmail.com with ESMTPSA id ce20sm2293923pjb.16.2019.08.12.07.11.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Aug 2019 07:11:24 -0700 (PDT) Subject: Re: [PATCH] ata: ahci: Lookup PCS register offset based on PCI device ID To: Stephen Douthit , Christoph Hellwig Cc: "linux-ide@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Dan Williams References: <20190808202415.25166-1-stephend@silicom-usa.com> <20190810074317.GA18582@infradead.org> From: Jens Axboe Message-ID: <679188f7-bb14-1de6-b533-687809fa7bc8@kernel.dk> Date: Mon, 12 Aug 2019 08:11:22 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/12/19 6:02 AM, Stephen Douthit wrote: > On 8/10/19 3:43 AM, Christoph Hellwig wrote: >> On Thu, Aug 08, 2019 at 08:24:31PM +0000, Stephen Douthit wrote: >>> Intel moved the PCS register from 0x92 to 0x94 on Denverton for some >>> reason, so now we get to check the device ID before poking it on reset. >> >> And now you just match on the new IDs, which means we'll perpetually >> catch up on any new device. Dan, can you reach out inside Intel to >> figure out if there is a way to find out the PCS register location >> without the PCI ID check? >> >> >>> static int ahci_pci_reset_controller(struct ata_host *host) >>> { >>> struct pci_dev *pdev = to_pci_dev(host->dev); >>> @@ -634,13 +669,14 @@ static int ahci_pci_reset_controller(struct ata_host *host) >>> >>> if (pdev->vendor == PCI_VENDOR_ID_INTEL) { >>> struct ahci_host_priv *hpriv = host->private_data; >>> + int pcs = ahci_pcs_offset(host); >>> u16 tmp16; >>> >>> /* configure PCS */ >>> - pci_read_config_word(pdev, 0x92, &tmp16); >>> + pci_read_config_word(pdev, pcs, &tmp16); >>> if ((tmp16 & hpriv->port_map) != hpriv->port_map) { >>> - tmp16 |= hpriv->port_map; >>> - pci_write_config_word(pdev, 0x92, tmp16); >>> + tmp16 |= hpriv->port_map & 0xff; >>> + pci_write_config_word(pdev, pcs, tmp16); >>> } >>> } >> >> And Stephen, while you are at it, can you split this Intel-specific >> quirk into a separate helper? > > I can do that. I'll wait until we hear back from Dan if there's a > better scheme than a device ID lookup. I'll drop the previous series for now. -- Jens Axboe