Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6242387imm; Mon, 27 Aug 2018 12:10:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZKfEPEsprOcsJH0CYkL8rK+GxQetShGgRvOlDR979fdBJwEPxsZq9tzge5bJdyWst9y6B6 X-Received: by 2002:a63:df04:: with SMTP id u4-v6mr13587488pgg.434.1535397001551; Mon, 27 Aug 2018 12:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535397001; cv=none; d=google.com; s=arc-20160816; b=G+/aTvFUcFxEXac0ZR+O+dBRTezmFNzneXXQGwVTUsipV63e5k8jIdZ2/hmlnVusF8 0cBqT/62c+KSMw/7WEjPOgIv+khZy8cPjM+qnwC1DKKkj8vregMeV5GA6V+mu9yT35YI I4MS0f6PUE9aiwR3Ban9ki9Wz7jiCY2Bb32zgI+unBHi3tSh+0bKdA1BktcYUV8IBCnr NuQ1MuCk47VnMJ1QMwjvpSl/Gp5JgkWoUxiDkpgkOvr6oqEcNaPRRX9i7KzqOdhKfS1S j+8zGEB0nFtW7mSAQmlvDujBliDJxylEsnlzXQ4agy3towqr+CV85UhZS7oK2v9/y4tS Zlgw== 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:arc-authentication-results; bh=OtDY3ixZhrvDqq62MihNwSrVjKh6PMmJKDwrqfbGo3A=; b=Oo96f+6T3cqL20+bUgun+d3nKWyKBtZqX1n4u6e3f/U69N1az3l8lBmZRugD75YsQH esiHp3fL2gESluESwZghI/jZwZ0QBPkyLUWXWhc8DgSsGYFdSZjDwplrQrVywh+oejPy 4z1xZLKbGOjaTtXNexDyhWHlKNzrYSUkS+RnSoVCgeQedRY1sNZYFNbAgZQTqYVL3P52 XpQOkw7IZ8iGQDR3wd1ewbiUIdXCbG4FIwB+bxjcAP1sORQs7NwCon5VnMnqNSeY7t7t 75z51oDkNkXNi9+GS//0x0mkZZJ02faxzJJgWai6/rcLuLvhjhpj9nxnANjC01sUEZq8 3jtw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b16-v6si5924pgg.342.2018.08.27.12.09.45; Mon, 27 Aug 2018 12:10:01 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727585AbeH0W4a (ORCPT + 99 others); Mon, 27 Aug 2018 18:56:30 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:55442 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727340AbeH0W4a (ORCPT ); Mon, 27 Aug 2018 18:56:30 -0400 Received: by mail-wm0-f67.google.com with SMTP id f21-v6so9282wmc.5 for ; Mon, 27 Aug 2018 12:08:37 -0700 (PDT) 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=OtDY3ixZhrvDqq62MihNwSrVjKh6PMmJKDwrqfbGo3A=; b=h1CnXbMIuQAbhsksYlkTvxpUuLiPGBeubJqKUxO9yeM8J5npeyJGn3y+nnjezroMCI zQwPa+8wEdOW+c2+r2yIFbYCUIkF45dIamSekl9xSACUhAtBqauEoaEIesJi5TirNBFr 9JKnK49k/hu+Fyusi1Lrsz6OTEkqfzZefFfDFbB9x+HfnjLI7aD/p45KBAEwF/gcqoVr rq0QI7bHOyl7yM7at7lC+B5oDt26ppG5cwASaFXgP+T4dFzD7z7TQX7o9z3Dr4FTk2IH af/Dhxep9kBFvGfFEAPnY0u++4ELYEIg9gHWlHdR7HOWyTvRz2iR3upjRdWAG/Hkru8y vwGA== X-Gm-Message-State: APzg51ABsxoRjmaSKBDdtuUXunUpv0rAZ4slswBPi1PuQOPOuqOMrZ1t RjXCaZw8oY1yHTn7r5Q6J6w30w== X-Received: by 2002:a1c:c203:: with SMTP id s3-v6mr6971350wmf.65.1535396917322; Mon, 27 Aug 2018 12:08:37 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id v5-v6sm15951wru.60.2018.08.27.12.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 12:08:36 -0700 (PDT) Subject: Re: [PATCH] ata: Disable AHCI ALPM feature for Ampere Computing eMAG SATA To: Suman Tripathi , tj@kernel.org, linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joe@perches.com, arnd@arndb.de, gregkh@linuxfoundation.org Cc: patches@amperecomputing.com, Rameshwar Prasad Sahu , Jens Axboe References: <1535395673-30649-1-git-send-email-stripathi@amperecomputing.com> From: Hans de Goede Message-ID: Date: Mon, 27 Aug 2018 21:08:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1535395673-30649-1-git-send-email-stripathi@amperecomputing.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 Hi, On 27-08-18 20:47, Suman Tripathi wrote: > Due to hardware errata, Ampere Computing eMAG SATA can't support > AHCI ALPM feature. This patch disables the AHCI ALPM feature for > eMAG SATA. > > Signed-off-by: Suman Tripathi > Signed-off-by: Rameshwar Prasad Sahu Thank you for the patch. 2 remarks: 1) The ata code is maintained by Jens Axboe (added to the Cc) now, this is a very recent change, which still has to hit MAINTAINERS 2) See below > --- > drivers/ata/ahci_platform.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c > index 99f9a89..0d0233e 100644 > --- a/drivers/ata/ahci_platform.c > +++ b/drivers/ata/ahci_platform.c > @@ -26,7 +26,7 @@ > > #define DRV_NAME "ahci" > > -static const struct ata_port_info ahci_port_info = { > +static struct ata_port_info ahci_port_info = { > .flags = AHCI_FLAG_COMMON, > .pio_mask = ATA_PIO4, > .udma_mask = ATA_UDMA6, Please do not remove const here, if you need to make a shared info struct like this non const you are usually doing something wrong (see below). > @@ -41,6 +41,8 @@ static int ahci_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct ahci_host_priv *hpriv; > + struct acpi_device_info *info; > + acpi_status status; > int rc; > > hpriv = ahci_platform_get_resources(pdev); > @@ -57,6 +59,15 @@ static int ahci_probe(struct platform_device *pdev) > if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) > hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; > > + status = acpi_get_object_info(ACPI_HANDLE(dev), &info); > + if (ACPI_SUCCESS(status)) { > + if (info->valid & ACPI_VALID_HID) { > + if (!strcmp("APMC0D33", info->hardware_id.string)) > + ahci_port_info.flags |= ATA_FLAG_NO_LPM; > + } > + ACPI_FREE(info); > + } > + > rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, > &ahci_platform_sht); > if (rc) The normal way to get specific behavior for a specific ACPI HID is to put the HID in the ahci_acpi_match table and use the acpi_device_id field to pass some flags (or a pointer). So the proper way to fix this is to do something like this: 1) Add: static const struct ata_port_info ahci_port_info_nolpm = { .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_LPM, .pio_mask = ATA_PIO4, .udma_mask = ATA_UDMA6, .port_ops = &ahci_platform_ops, }; 2) Modify ahci_acpi_match table to: static const struct acpi_device_id ahci_acpi_match[] = { { "APMC0D33", (unsigned long)&ahci_port_info_nolpm }, { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) }, {}, }; 3) In ahci_probe() do: const struct ata_port_info *port; ... port = acpi_device_get_match_data(dev); if (!port) port = &ahci_port_info; rc = ahci_platform_init_host(pdev, hpriv, port, &ahci_platform_sht); Regards, Hans