Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9123BC433E0 for ; Mon, 15 Mar 2021 10:54:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E90E64E21 for ; Mon, 15 Mar 2021 10:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbhCOKyG (ORCPT ); Mon, 15 Mar 2021 06:54:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52218 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229524AbhCOKxz (ORCPT ); Mon, 15 Mar 2021 06:53:55 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12FAXr6u104876 for ; Mon, 15 Mar 2021 06:53:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=zbzNTnIJ7ZLwkgLLD5QMMGmY8nDaxKn1dFBIB60bw7w=; b=dqMtC4kpBAQEtrPLvzPtu51daTXOuMq7+ky0y0ipUOWrJbUelAehpFIvjxUHbgJdS/nu rkJzR3Z6//zlggLPiCYV4N0ilQhRxpTGdT1q1o5ef3OSgkwj7JmzgvWwjRCv3WqhjHaL 2LiC1X2UWTRar+DVwG9WvgkiBw3dzJeWKgigu9aQpMxYwjXqCcHm25Jy8YjO5FGUJufE 1Uq1zxlRjdc8E+ldF4/Auwedgel9/s5f8m12ufa+tijSmpvA9Y+/nMIqlq4ugwJ7sINW TXUtZz6mQkZ1cdYyZmiu925cVj4nItTnmVaW3/Huhrgi3gHGOzB0XJLr/8E3W7psNNjD EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 379yj1t1bn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 15 Mar 2021 06:53:54 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12FAYMoq106190 for ; Mon, 15 Mar 2021 06:53:54 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 379yj1t1bc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Mar 2021 06:53:54 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12FAm2Mn006901; Mon, 15 Mar 2021 10:53:52 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma05fra.de.ibm.com with ESMTP id 378n188wwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Mar 2021 10:53:52 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12FArXrL34865440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 15 Mar 2021 10:53:33 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55FD5A4051; Mon, 15 Mar 2021 10:53:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB307A404D; Mon, 15 Mar 2021 10:53:48 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.14.133]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 15 Mar 2021 10:53:48 +0000 (GMT) Subject: Re: [kvm-unit-tests PATCH v6 5/6] s390x: css: testing measurement block format 0 To: Pierre Morel , kvm@vger.kernel.org Cc: david@redhat.com, thuth@redhat.com, cohuck@redhat.com, imbrenda@linux.ibm.com References: <1615545714-13747-1-git-send-email-pmorel@linux.ibm.com> <1615545714-13747-6-git-send-email-pmorel@linux.ibm.com> From: Janosch Frank Message-ID: <0b2ebdfd-c6f9-bca2-b2d7-5187bdfab4a2@linux.ibm.com> Date: Mon, 15 Mar 2021 11:53:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <1615545714-13747-6-git-send-email-pmorel@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-15_03:2021-03-15,2021-03-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103150072 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 3/12/21 11:41 AM, Pierre Morel wrote: > We test the update of the measurement block format 0, the > measurement block origin is calculated from the mbo argument > used by the SCHM instruction and the offset calculated using > the measurement block index of the SCHIB. > > Signed-off-by: Pierre Morel Acked-by: Janosch Frank > --- > lib/s390x/css.h | 12 +++++++ > s390x/css.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 95 insertions(+) > > diff --git a/lib/s390x/css.h b/lib/s390x/css.h > index 7158423..335bc70 100644 > --- a/lib/s390x/css.h > +++ b/lib/s390x/css.h > @@ -374,4 +374,16 @@ static inline void schm(void *mbo, unsigned int flags) > bool css_enable_mb(int sid, uint64_t mb, uint16_t mbi, uint16_t flg, bool fmt1); > bool css_disable_mb(int schid); > > +struct measurement_block_format0 { > + uint16_t ssch_rsch_count; > + uint16_t sample_count; > + uint32_t device_connect_time; > + uint32_t function_pending_time; > + uint32_t device_disconnect_time; > + uint32_t cu_queuing_time; > + uint32_t device_active_only_time; > + uint32_t device_busy_time; > + uint32_t initial_cmd_resp_time; > +}; > + > #endif > diff --git a/s390x/css.c b/s390x/css.c > index af68266..658c5f8 100644 > --- a/s390x/css.c > +++ b/s390x/css.c > @@ -133,6 +133,13 @@ error_ccw: > free_io_mem(senseid, sizeof(*senseid)); > } > > +static void sense_id(void) > +{ > + assert(!start_ccw1_chain(test_device_sid, ccw)); > + > + assert(wait_and_check_io_completion(test_device_sid) >= 0); > +} > + > static void css_init(void) > { > assert(register_io_int_func(css_irq_io) == 0); > @@ -175,6 +182,81 @@ static void test_schm(void) > report_prefix_pop(); > } > > +#define SCHM_UPDATE_CNT 10 > +static bool start_measuring(uint64_t mbo, uint16_t mbi, bool fmt1) > +{ > + int i; > + > + senseid = alloc_io_mem(sizeof(*senseid), 0); > + assert(senseid); > + > + ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI); > + assert(ccw); > + > + if (!css_enable_mb(test_device_sid, mbo, mbi, PMCW_MBUE, fmt1)) { > + report_abort("Enabling measurement block failed"); > + return false; > + } > + > + for (i = 0; i < SCHM_UPDATE_CNT; i++) > + sense_id(); > + > + free_io_mem(ccw, sizeof(*ccw)); > + free_io_mem(senseid, sizeof(*senseid)); > + > + return true; > +} > + > +/* > + * test_schm_fmt0: > + * With measurement block format 0 a memory space is shared > + * by all subchannels, each subchannel can provide an index > + * for the measurement block facility to store the measurements. > + */ > +static void test_schm_fmt0(void) > +{ > + struct measurement_block_format0 *mb0; > + int shared_mb_size = 2 * sizeof(struct measurement_block_format0); > + > + if (!test_device_sid) { > + report_skip("No device"); > + return; > + } > + > + /* Allocate zeroed Measurement block */ > + mb0 = alloc_io_mem(shared_mb_size, 0); > + if (!mb0) { > + report_abort("measurement_block_format0 allocation failed"); > + return; > + } > + > + schm(NULL, 0); /* Stop any previous measurement */ > + schm(mb0, SCHM_MBU); > + > + /* Expect success */ > + report_prefix_push("Valid MB address and index 0"); > + report(start_measuring(0, 0, false) && > + mb0->ssch_rsch_count == SCHM_UPDATE_CNT, > + "SSCH measured %d", mb0->ssch_rsch_count); > + report_prefix_pop(); > + > + /* Clear the measurement block for the next test */ > + memset(mb0, 0, shared_mb_size); > + > + /* Expect success */ > + report_prefix_push("Valid MB address and index 1"); > + if (start_measuring(0, 1, false)) > + report(mb0[1].ssch_rsch_count == SCHM_UPDATE_CNT, > + "SSCH measured %d", mb0[1].ssch_rsch_count); > + report_prefix_pop(); > + > + /* Stop the measurement */ > + css_disable_mb(test_device_sid); > + schm(NULL, 0); > + > + free_io_mem(mb0, shared_mb_size); > +} > + > static struct { > const char *name; > void (*func)(void); > @@ -185,6 +267,7 @@ static struct { > { "enable (msch)", test_enable }, > { "sense (ssch/tsch)", test_sense }, > { "measurement block (schm)", test_schm }, > + { "measurement block format0", test_schm_fmt0 }, > { NULL, NULL } > }; > >