From nobody Mon Nov 25 07:34:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1717403953; cv=none; d=zohomail.com; s=zohoarc; b=auVUHXKz6HbXGw3hYqz6jbTxmacoplHSB7Z6lgXAtqBQvQraIdkG1udcmCimZeBMM0GFshvljJeqGTElgv2jBIXqtqojDqb/vk9SK8EsPzqTmOgMrp3VnjhIPid1LTg1LVWntM+qpFGoPW+BouSA3fzom94lBmi7lPEOAFEcRHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717403953; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZI3aQe+3NCl7TYdk0QhMrQ77IoRzmkb0sJWAqE2N5M8=; b=F2fxPJmd4LJr25O59BzPNK/b67IBH0YbeXyuGzR6xEYuipITDbWHIp0Nl/9OMk3pNQlP6IDEOI/+g+9hp7ntdvsLStb4SlEaUBksQudlW9WZDcA/BR3D85D2+FIMb2gjRezthVoap9JAzaQAMcEPSBva3eyLPIhyLD58AyMnEsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717403953230495.5814572132498; Mon, 3 Jun 2024 01:39:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE3CL-0007Jq-Mm; Mon, 03 Jun 2024 04:37:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sE3CK-0007JW-MQ; Mon, 03 Jun 2024 04:37:44 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sE3CI-0001FC-Qu; Mon, 03 Jun 2024 04:37:44 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-702548b056aso1453727b3a.1; Mon, 03 Jun 2024 01:37:42 -0700 (PDT) Received: from jeuk-MS-7D42.. ([210.223.46.112]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702425e0c6dsm5020762b3a.89.2024.06.03.01.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717403859; x=1718008659; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZI3aQe+3NCl7TYdk0QhMrQ77IoRzmkb0sJWAqE2N5M8=; b=aCCl8SZGq3PjmF2GaUk2aFuyLqZ4XAnusQUT/s/VwuzVjsjP78kdxc3nG5MIto5Sj5 CJaKpUm4Ktxo6DA92/jYBrZkkxegbbcRp7+6IHfCCBwZrZTbQfF1FBc1ULvzPxLuJ2rt z/8gYuLpj7iQsTJ/1EYYP6LVZ6tMcOhlG70Np7SWTJqi1zZjY6d7ABJ+eg2ID6pEwu9K qR8jAVvi6qLl2xcWZNCCq//aqpjYRrmXT/NU+o5NOTBZfk7Tsw1RO+sADFdImoHyoLNH z6PzNIfxzzbwxTnUWgFxVw+qvSAYKNJnQDku/1P8MyMDo2S9b+NyUEt20X4o6ho8Bh5S jfzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717403859; x=1718008659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZI3aQe+3NCl7TYdk0QhMrQ77IoRzmkb0sJWAqE2N5M8=; b=CdPCd0wAjwdhviIGhN0Ma/n7lZDJBED7eRJPqcGLupCjNVT8xFZkQ1bNZch3pEThtG kxPffnQhxgN5emeyNwtGTvbgpvhhDo3XSTJv1MzA0JonPysfEBZbGnOzZDu6VUjJA2KZ tNky449ZW9tfaASjZ0j60Y55j7w7LRmpQMR0kUfeOyGSl7RSChAOFAI2wOijM0RlNazo ETdEAhGc4ahzRDO4JoXKdsAkFHYTiD6iE/3yDW1eN5Nq5FaYfgC9jIMBVW7fXxlVc7Um mP5ALLtR53d4GUoy2aatSBcqDfwUxKtH8bLUbYAuO27C2F83cu0wRvTrWdxchcMVGcg4 hD3w== X-Forwarded-Encrypted: i=1; AJvYcCX2pqrXcjt5YjYmqaCmw2hcK8V21VMtLQCCbv7PQuIOjvoBs0WXmjqvl+T9ETgWWlBTjNn9sauHZaW8/LwbCTkHEw9rRDs= X-Gm-Message-State: AOJu0YwOdv7U6ImqVKgbsgQbL6SOV9MbOaf2sidVh24eWklT7bbVIeJu LzJA4IxYgY49SOJnDT6pT0Mj1Js6KlYyzDXFlQFTb45HqnbLjkTGLlzZyg== X-Google-Smtp-Source: AGHT+IFUvrPqlaZfIrf1H0qGFPSquKnLTTV4VcO9iXH3Xv9JekMbQKav32l7styMHjq3KS90p3gqEg== X-Received: by 2002:a05:6a00:1acf:b0:6ed:caf6:6e54 with SMTP id d2e1a72fcca58-702478f8449mr7722861b3a.28.1717403859460; Mon, 03 Jun 2024 01:37:39 -0700 (PDT) From: Jeuk Kim To: qemu-devel@nongnu.org, richard.henderson@linaro.org Cc: fam@euphon.net, pbonzini@redhat.com, qemu-block@nongnu.org, jeuk20.kim@samsung.com, j-young.choi@samsung.com, minwoo.im@samsung.com Subject: [PULL v2 1/2] hw/ufs: Update MCQ-related fields to block/ufs.h Date: Mon, 3 Jun 2024 17:37:24 +0900 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=jeuk20.kim@gmail.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1717403955218100001 Content-Type: text/plain; charset="utf-8" From: Minwoo Im This patch is a prep patch for the following MCQ support patch for hw/ufs. This patch updated minimal mandatory fields to support MCQ based on UFSHCI 4.0. Signed-off-by: Minwoo Im Reviewed-by: Jeuk Kim Message-Id: <20240528023106.856777-2-minwoo.im@samsung.com> Signed-off-by: Jeuk Kim --- include/block/ufs.h | 108 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/include/block/ufs.h b/include/block/ufs.h index d61598b8f3..3513b6e772 100644 --- a/include/block/ufs.h +++ b/include/block/ufs.h @@ -7,7 +7,7 @@ =20 typedef struct QEMU_PACKED UfsReg { uint32_t cap; - uint32_t rsvd0; + uint32_t mcqcap; uint32_t ver; uint32_t rsvd1; uint32_t hcpid; @@ -46,6 +46,13 @@ typedef struct QEMU_PACKED UfsReg { uint32_t rsvd7[4]; uint32_t rsvd8[16]; uint32_t ccap; + uint32_t rsvd9[127]; + uint32_t config; + uint32_t rsvd10[3]; + uint32_t rsvd11[28]; + uint32_t mcqconfig; + uint32_t esilba; + uint32_t esiuba; } UfsReg; =20 REG32(CAP, offsetof(UfsReg, cap)) @@ -57,6 +64,15 @@ REG32(CAP, offsetof(UfsReg, cap)) FIELD(CAP, OODDS, 25, 1) FIELD(CAP, UICDMETMS, 26, 1) FIELD(CAP, CS, 28, 1) + FIELD(CAP, LSDBS, 29, 1) + FIELD(CAP, MCQS, 30, 1) +REG32(MCQCAP, offsetof(UfsReg, mcqcap)) + FIELD(MCQCAP, MAXQ, 0, 8) + FIELD(MCQCAP, SP, 8, 1) + FIELD(MCQCAP, RRP, 9, 1) + FIELD(MCQCAP, EIS, 10, 1) + FIELD(MCQCAP, QCFGPTR, 16, 8) + FIELD(MCQCAP, MIAG, 24, 8) REG32(VER, offsetof(UfsReg, ver)) REG32(HCPID, offsetof(UfsReg, hcpid)) REG32(HCMID, offsetof(UfsReg, hcmid)) @@ -78,6 +94,7 @@ REG32(IS, offsetof(UfsReg, is)) FIELD(IS, HCFES, 16, 1) FIELD(IS, SBFES, 17, 1) FIELD(IS, CEFES, 18, 1) + FIELD(IS, CQES, 20, 1) REG32(IE, offsetof(UfsReg, ie)) FIELD(IE, UTRCE, 0, 1) FIELD(IE, UDEPRIE, 1, 1) @@ -95,6 +112,7 @@ REG32(IE, offsetof(UfsReg, ie)) FIELD(IE, HCFEE, 16, 1) FIELD(IE, SBFEE, 17, 1) FIELD(IE, CEFEE, 18, 1) + FIELD(IE, CQEE, 20, 1) REG32(HCS, offsetof(UfsReg, hcs)) FIELD(HCS, DP, 0, 1) FIELD(HCS, UTRLRDY, 1, 1) @@ -128,6 +146,10 @@ REG32(UCMDARG1, offsetof(UfsReg, ucmdarg1)) REG32(UCMDARG2, offsetof(UfsReg, ucmdarg2)) REG32(UCMDARG3, offsetof(UfsReg, ucmdarg3)) REG32(CCAP, offsetof(UfsReg, ccap)) +REG32(CONFIG, offsetof(UfsReg, config)) + FIELD(CONFIG, QT, 0, 1) +REG32(MCQCONFIG, offsetof(UfsReg, mcqconfig)) + FIELD(MCQCONFIG, MAC, 8, 8) =20 #define UFS_INTR_MASK \ ((1 << R_IS_CEFES_SHIFT) | (1 << R_IS_SBFES_SHIFT) | \ @@ -157,6 +179,69 @@ REG32(CCAP, offsetof(UfsReg, ccap)) ((be32_to_cpu(dword2) >> UFS_UPIU_HEADER_DATA_SEGMENT_LENGTH_SHIFT) & \ UFS_UPIU_HEADER_DATA_SEGMENT_LENGTH_MASK) =20 +typedef struct QEMU_PACKED UfsMcqReg { + uint32_t sqattr; + uint32_t sqlba; + uint32_t squba; + uint32_t sqdao; + uint32_t sqisao; + uint32_t sqcfg; + uint32_t rsvd0[2]; + uint32_t cqattr; + uint32_t cqlba; + uint32_t cquba; + uint32_t cqdao; + uint32_t cqisao; + uint32_t cqcfg; + uint32_t rsvd1[2]; +} UfsMcqReg; + +REG32(SQATTR, offsetof(UfsMcqReg, sqattr)) + FIELD(SQATTR, SIZE, 0, 16) + FIELD(SQATTR, CQID, 16, 8) + FIELD(SQATTR, SQPL, 28, 3) + FIELD(SQATTR, SQEN, 31, 1) +REG32(SQLBA, offsetof(UfsMcqReg, sqlba)) +REG32(SQUBA, offsetof(UfsMcqReg, squba)) +REG32(SQDAO, offsetof(UfsMcqReg, sqdao)) +REG32(SQISAO, offsetof(UfsMcqReg, sqisao)) +REG32(SQCFG, offsetof(UfsMcqReg, sqcfg)) +REG32(CQATTR, offsetof(UfsMcqReg, cqattr)) + FIELD(CQATTR, SIZE, 0, 16) + FIELD(CQATTR, CQEN, 31, 1) +REG32(CQLBA, offsetof(UfsMcqReg, cqlba)) +REG32(CQUBA, offsetof(UfsMcqReg, cquba)) +REG32(CQDAO, offsetof(UfsMcqReg, cqdao)) +REG32(CQISAO, offsetof(UfsMcqReg, cqisao)) +REG32(CQCFG, offsetof(UfsMcqReg, cqcfg)) + +typedef struct QEMU_PACKED UfsMcqSqReg { + uint32_t hp; + uint32_t tp; + uint32_t rtc; + uint32_t cti; + uint32_t rts; +} UfsMcqSqReg; + +typedef struct QEMU_PACKED UfsMcqCqReg { + uint32_t hp; + uint32_t tp; +} UfsMcqCqReg; + +typedef struct QEMU_PACKED UfsMcqSqIntReg { + uint32_t is; + uint32_t ie; +} UfsMcqSqIntReg; + +typedef struct QEMU_PACKED UfsMcqCqIntReg { + uint32_t is; + uint32_t ie; + uint32_t iacr; +} UfsMcqCqIntReg; + +REG32(CQIS, offsetof(UfsMcqCqIntReg, is)) + FIELD(CQIS, TEPS, 0, 1) + typedef struct QEMU_PACKED DeviceDescriptor { uint8_t length; uint8_t descriptor_idn; @@ -1064,9 +1149,26 @@ typedef struct QEMU_PACKED UtpUpiuRsp { }; } UtpUpiuRsp; =20 +/* + * MCQ Completion Queue Entry + */ +typedef UtpTransferReqDesc UfsSqEntry; +typedef struct QEMU_PACKED UfsCqEntry { + uint64_t utp_addr; + uint16_t resp_len; + uint16_t resp_off; + uint16_t prdt_len; + uint16_t prdt_off; + uint8_t status; + uint8_t error; + uint16_t rsvd1; + uint32_t rsvd2[3]; +} UfsCqEntry; + static inline void _ufs_check_size(void) { - QEMU_BUILD_BUG_ON(sizeof(UfsReg) !=3D 0x104); + QEMU_BUILD_BUG_ON(sizeof(UfsReg) !=3D 0x38C); + QEMU_BUILD_BUG_ON(sizeof(UfsMcqReg) !=3D 64); QEMU_BUILD_BUG_ON(sizeof(DeviceDescriptor) !=3D 89); QEMU_BUILD_BUG_ON(sizeof(GeometryDescriptor) !=3D 87); QEMU_BUILD_BUG_ON(sizeof(UnitDescriptor) !=3D 45); @@ -1086,5 +1188,7 @@ static inline void _ufs_check_size(void) QEMU_BUILD_BUG_ON(sizeof(UtpTaskReqDesc) !=3D 80); QEMU_BUILD_BUG_ON(sizeof(UtpCmdRsp) !=3D 40); QEMU_BUILD_BUG_ON(sizeof(UtpUpiuRsp) !=3D 288); + QEMU_BUILD_BUG_ON(sizeof(UfsSqEntry) !=3D 32); + QEMU_BUILD_BUG_ON(sizeof(UfsCqEntry) !=3D 32); } #endif --=20 2.34.1