Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8659732ybn; Tue, 1 Oct 2019 11:15:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcbjB7OTKCXIM/iV2F/RHrxoKiT3w0C3V3X7BTjoT9SWHlyBh9M8wGqeh6cyEncbf+Rs8+ X-Received: by 2002:a05:6402:a50:: with SMTP id bt16mr26694251edb.114.1569953717474; Tue, 01 Oct 2019 11:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569953717; cv=none; d=google.com; s=arc-20160816; b=RlO2Ta2DmcpMK5YlKY7yw+AKQPSzRdACfCmyDYPCHK5W08XAG1VcRcNhrCt9jyCZI0 gXrikIBMP7KKy+9NAs20Ghn9Fu6oorB0rzWcXf6MVo8mlpEzeyN52LB/MEO6zixErxLd uWJ/2l+ihGPrzAAEEmVFn/p3nHAVZwUjKd4mZBkLiW2ktjIF8xGMIOrpv9FJTlzmIlq4 8yVl2tMKOmrG2tUIKvoYn7Zf1s87D5Ol1YIFhdMhcyqe7cUPRKw/M+wn6waLobHzsKMa PWBNb1GAkv8mYgF8sIxCUTJHCwzROq4UdbBA9lGEWl21xp3z7EjeRtzL+WJNSrU/ASCq hehQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=RaiO7KgO6Gkx38Eh2brE9qaYaKO5NtDoBJB5Djv5Ffs=; b=PIC6ukQTQ8dYWP7BirWneCBOVPbYmBvt73bA8rqKczSKgu0engYZYrSEPzJGS6gILU wGJbasNBp43vTTnsCKLXW31KozrQXePpVjoeI1T9sUTluuADrz+il5b6ucQ6gsi5zSFD zXxirrOB9k7w5pJiT44wYNzGr3kWmwB1EicW/SfyeGDErn5YbchN8A72VyBylkg15Yr4 AWhhaL23ilqew+8z3Jco1/f278C63o6NilqBfLcsaMfV6x/ICU9BSvvrzoz546RtncST 6JrRj35JuDyUSwf21UHmzTGsYpOBQ4C8CqmZeVU4llDKAqdiPVMJ6aoCO/YbZb1kROUV iM/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dell.com header.s=smtpout1 header.b=D21jo5mC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=dell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si9253135eja.273.2019.10.01.11.14.51; Tue, 01 Oct 2019 11:15:17 -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=@dell.com header.s=smtpout1 header.b=D21jo5mC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=dell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731838AbfJASO3 (ORCPT + 99 others); Tue, 1 Oct 2019 14:14:29 -0400 Received: from mx0b-00154904.pphosted.com ([148.163.137.20]:31444 "EHLO mx0b-00154904.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728408AbfJASO3 (ORCPT ); Tue, 1 Oct 2019 14:14:29 -0400 Received: from pps.filterd (m0170395.ppops.net [127.0.0.1]) by mx0b-00154904.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x91I5J5X028164; Tue, 1 Oct 2019 14:14:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=smtpout1; bh=RaiO7KgO6Gkx38Eh2brE9qaYaKO5NtDoBJB5Djv5Ffs=; b=D21jo5mCVVQT2GxX9Tn0E2EPPBBvGJWlpSGI/2MfWlKeG238UBHuGhQ3bI91SbG5rj2q 3wCnCLw4q4Y28UXjUT5LcFz1WDxCwDhzOZRvudoug+4EqnfLYXjL02uBdPqBkz3QtKDv 9Aum42g8jL3/Df143aRkxiqrHAegamXuU9fy+JSD0c4CtvxIZKkVk4MVOuddkscBdrAM fUPXZQiyR5PuAJjuF3tslyLIygFrIW0NBojOy15Od9vE8PDj9V1Z/iUQfkPmzFX+EB9h 4wE7pLOPKsB7IBadDOwNDdcAyUgdROTjpFFvJpKQ2avw0qnQRnXOBQNYQk9/A3Y0xHVu GA== Received: from mx0a-00154901.pphosted.com (mx0a-00154901.pphosted.com [67.231.149.39]) by mx0b-00154904.pphosted.com with ESMTP id 2va46neqxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Oct 2019 14:14:27 -0400 Received: from pps.filterd (m0134746.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x91I8DaF105726; Tue, 1 Oct 2019 14:14:26 -0400 Received: from ausxipps310.us.dell.com (AUSXIPPS310.us.dell.com [143.166.148.211]) by mx0a-00154901.pphosted.com with ESMTP id 2vc2rut7h4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Oct 2019 14:14:26 -0400 X-LoopCount0: from 10.166.132.133 X-PREM-Routing: D-Outbound X-IronPort-AV: E=Sophos;i="5.60,349,1549951200"; d="scan'208";a="429845825" From: To: , CC: , , , , , , , , , Subject: RE: [RFC PATCH 17/22] thunderbolt: Add initial support for USB4 Thread-Topic: [RFC PATCH 17/22] thunderbolt: Add initial support for USB4 Thread-Index: AQHVeEzShOhklesInk+gx9St4A7986dGAqiggAATYiA= Date: Tue, 1 Oct 2019 18:14:23 +0000 Message-ID: <5357cb96013445d79f5c2016df8a194e@AUSX13MPC105.AMER.DELL.COM> References: <20191001113830.13028-1-mika.westerberg@linux.intel.com> <20191001113830.13028-18-mika.westerberg@linux.intel.com> <184c95fc476146939b240557e54ee2c9@AUSX13MPC105.AMER.DELL.COM> In-Reply-To: <184c95fc476146939b240557e54ee2c9@AUSX13MPC105.AMER.DELL.COM> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Enabled=True; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SiteId=945c199a-83a2-4e80-9f8c-5a91be5752dd; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Owner=Mario_Limonciello@Dell.com; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_SetDate=2019-10-01T17:05:07.4414478Z; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Name=External Public; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Application=Microsoft Azure Information Protection; MSIP_Label_17cb76b2-10b8-4fe1-93d4-2202842406cd_Extended_MSFT_Method=Manual; aiplabel=External Public x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.18.86] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-01_08:2019-10-01,2019-10-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=931 mlxscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1015 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910010147 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 impostorscore=0 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910010147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Limonciello, Mario > Sent: Tuesday, October 1, 2019 12:05 PM > To: 'Mika Westerberg'; linux-usb@vger.kernel.org > Cc: Andreas Noever; Michael Jamet; Yehezkel Bernat; Rajmohan Mani; Nichol= as > Johnson; Lukas Wunner; Greg Kroah-Hartman; Alan Stern; Anthony Wong; linu= x- > kernel@vger.kernel.org > Subject: RE: [RFC PATCH 17/22] thunderbolt: Add initial support for USB4 >=20 > > @@ -322,9 +398,21 @@ static int tb_switch_nvm_add(struct tb_switch *sw) > > u32 val; > > int ret; > > > > - if (!sw->dma_port) > > + if (!nvm_readable(sw)) > > return 0; > > > > + /* > > + * The NVM format of non-Intel hardware is not known so > > + * currently restrict NVM upgrade for Intel hardware. We may > > + * relax this in the future when we learn other NVM formats. > > + */ > > + if (sw->config.vendor_id !=3D PCI_VENDOR_ID_INTEL) { > > + dev_info(&sw->dev, > > + "NVM format of vendor %#x is not known, disabling NVM > > upgrade\n", > > + sw->config.vendor_id); > > + return 0; > > + } > > + >=20 > Don't you actually have an attribute you can use here for this exact purp= ose that > you > could be setting rather than returning immediately? > sw->no_nvm_upgrade >=20 One more thought; would you consider exporting to sysfs sw->config.vendor_i= d? Maybe an attribute that is switch_vendor? Userland fwupd also does validation on the NVM and will need to follow this= . The same check will go into fwupd to match the vendor and lack of nvm_non_a= ctive0 to mark the device as not updatable. When the checks in the kernel get rel= axed, some NVM parsing will have to make it over to fwupd too to relax the check = at that point. > Then potentially you can at least let users "dump out" the nvm on !Intel = but don't > let > it be written until ready to relax further. >=20 > > nvm =3D kzalloc(sizeof(*nvm), GFP_KERNEL); > > if (!nvm) > > return -ENOMEM;