Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5268071rwd; Mon, 12 Jun 2023 02:29:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Y1p6tWkpKmewEwKUbulwodhTIsxxLMwa7rCrs377/i1STnET8Ei+q4c4njVilnHirv4mX X-Received: by 2002:a2e:8684:0:b0:2b1:e69e:ca9c with SMTP id l4-20020a2e8684000000b002b1e69eca9cmr2102012lji.14.1686562162353; Mon, 12 Jun 2023 02:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686562162; cv=none; d=google.com; s=arc-20160816; b=bK0Vot/2EIAgy1W4FoN2552eRCb5+XAa3ztJ9S0z3abyojncZ7HAsFp01giG5fRhve 24du4/esgqo45im8Qtd97RL3XPYYmGzW8ttesa7kKtewwG71ZpYjL8QKCsa4bDBAfE48 wLHCcy9AYXabv6X4P1yDHAP3xtv9XOKkE/1ZbiF/whMNkNDp0OPg8CXgE3A8BBsptATp S7nNSsWQU/eH2KhoAKCor0HdwPQPc64a5l7Cj9eEy5jNlQ/G0cZ+r/dOeeKBCgwdP8dy 9xtFb0SzwlATp6VF056UJRvZK/ceY9SYb0nc6nfCndPysZigMU9QLS4xJ13mFT5DHc7B gV1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=l+ctUZaiR/2JgRiWlTIsz979BCfM3huwLMiHk8mzwGg=; b=Yp6t6ssjXvpS5w47Mkph902UrVxrzBFyRwfSsKQI02hgLsmuN1FGL+hTXXhxnZFfiX PrjMeBmGkbvDzaATkWp1m46T+LXM7SJW/iPnR2tPcxmYqnWUOqb9ZeptbYHPoN5yef/D O74QwcQrYmv9qsfGZySOJ64sKGJLBuHyjMWt+KRKYdOlUSv6clpIDlnvwDqxrFhCwVId 1YY6CvrE2DmnXXr7MAC18RxwOf4y0XCUEggT6RNdFlvXkDjCnmZQ5IxO1cPWy5h05Ug9 jzOyyMeFJEvL6HNgHpMz08E+A1Jee8iQO5wiGsSKE+QQ6K5kOtbVCY8Rsw0lKgorqQUo 3Mig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ox3cw6lj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020aa7d8d2000000b005149d17f9bbsi3697246eds.667.2023.06.12.02.28.57; Mon, 12 Jun 2023 02:29:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ox3cw6lj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232492AbjFLJCc (ORCPT + 99 others); Mon, 12 Jun 2023 05:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjFLJBk (ORCPT ); Mon, 12 Jun 2023 05:01:40 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8307DE77; Mon, 12 Jun 2023 01:58:27 -0700 (PDT) X-UUID: 4881b72c08ff11ee9cb5633481061a41-20230612 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=l+ctUZaiR/2JgRiWlTIsz979BCfM3huwLMiHk8mzwGg=; b=Ox3cw6ljR8CRwqHgsDPiGSoI03Q5+xPIidFrlNHsTap8I61PEr+QL2keEzEDX4rZXBBPWP0Y43AnPIFm5Rh7XVoshHiFB2Ey46UCT3Wz/w/BNumDLN7mjDVBdcB1ha+7zMKaaoyMfN1JuDdmE269dd3+9VjlM/T8Q+dAWpB/NA4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.26,REQID:dd3d5157-4b63-405f-9a65-aaff7edda675,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:cb9a4e1,CLOUDID:cff8253e-de1e-4348-bc35-c96f92f1dcbb,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4881b72c08ff11ee9cb5633481061a41-20230612 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 76957621; Mon, 12 Jun 2023 16:58:22 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 12 Jun 2023 16:58:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 12 Jun 2023 16:58:20 +0800 From: Po-Wen Kao To: , , , , Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , , Subject: [PATCH v1 1/4] scsi: ufs: core: Add host quirk UFSHCD_QUIRK_MCQ_BROKEN_INTR Date: Mon, 12 Jun 2023 16:58:09 +0800 Message-ID: <20230612085817.12275-2-powen.kao@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230612085817.12275-1-powen.kao@mediatek.com> References: <20230612085817.12275-1-powen.kao@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 Quirk UFSHCD_QUIRK_MCQ_BROKEN_INTR is introduced for host that implement different interrupt topology from UFSHCI 4.0 spec. Some host raise per hw queue interrupt in addition to CQES (traditional) when ESI is disabled. Enable this quirk will disable CQES and use only per hw queue interrupt. Signed-off-by: Po-Wen Kao Reviewed-by: Stanley Chu --- drivers/ufs/core/ufshcd.c | 6 +++++- include/ufs/ufshcd.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 5da62248ebc4..5e093eba897b 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8608,11 +8608,15 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba) static void ufshcd_config_mcq(struct ufs_hba *hba) { int ret; + u32 intrs; ret = ufshcd_mcq_vops_config_esi(hba); dev_info(hba->dev, "ESI %sconfigured\n", ret ? "is not " : ""); - ufshcd_enable_intr(hba, UFSHCD_ENABLE_MCQ_INTRS); + intrs = UFSHCD_ENABLE_MCQ_INTRS; + if (hba->quirks & UFSHCD_QUIRK_MCQ_BROKEN_INTR) + intrs &= ~MCQ_CQ_EVENT_STATUS; + ufshcd_enable_intr(hba, intrs); ufshcd_mcq_make_queues_operational(hba); ufshcd_mcq_config_mac(hba, hba->nutrs); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 9b2d1859f885..ea43ceaf881c 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -611,6 +611,13 @@ enum ufshcd_quirks { * to reinit the device after switching to maximum gear. */ UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH = 1 << 19, + + /* + * Some host raises interrupt (per queue) in addition to + * CQES (traditional) when ESI is disabled. + * Enable this quirk will disable CQES and use per queue interrupt. + */ + UFSHCD_QUIRK_MCQ_BROKEN_INTR = 1 << 20, }; enum ufshcd_caps { -- 2.18.0