From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 004ACC433DF for ; Fri, 7 Aug 2020 11:16:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D23022075D for ; Fri, 7 Aug 2020 11:16:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="H7mkflrp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbgHGLQZ (ORCPT ); Fri, 7 Aug 2020 07:16:25 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:3082 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbgHGLQG (ORCPT ); Fri, 7 Aug 2020 07:16:06 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 077B3RL1169762; Fri, 7 Aug 2020 07:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=M5gGijiGYAWuEfTOjLXZEguj1KdFU0EOt0KK6twlmG0=; b=H7mkflrpKmnbIrt3eBUDdbsJqc2iXv4XS/PhJQsZE/CDXlTvgbrtmxXFjtHiszWSyFAb oV/8A2iKXVUcnDrqAq8PIG/3qgh808laS7zDw73yREnwoA3vBXAu34IUMvHFIhVmmAV/ hv8RfD/A5AHHp5VZH0xRIDxPAuwmXdbSrhmUPY2fx7z+DrAJNhvW6T7qaB/2R3Ao2Lay EGDccPkricodVJkZyHjM3fCpUqYoIXt2COVFG+RCB37lcceVuaLlrKrCYX8rhov6ffo9 IpdFFH9/+sZ/90Xx2isifkstKGQ1gFqKG2dqasnxgCQsXrQO6X7qXRxaEGjEPIu/05oF xQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32ra0sm9qy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 07:16:05 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 077B5Cp5176989; Fri, 7 Aug 2020 07:16:05 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 32ra0sm9q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 07:16:05 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 077BG2VU026764; Fri, 7 Aug 2020 11:16:02 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 32n0186kct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Aug 2020 11:16:02 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 077BFxhQ28967350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Aug 2020 11:15:59 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CDE4AE051; Fri, 7 Aug 2020 11:15:59 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89E34AE055; Fri, 7 Aug 2020 11:15:58 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 7 Aug 2020 11:15:58 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: thuth@redhat.com, linux-s390@vger.kernel.org, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 1/3] s390x: Add custom pgm cleanup function Date: Fri, 7 Aug 2020 07:15:53 -0400 Message-Id: <20200807111555.11169-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200807111555.11169-1-frankja@linux.ibm.com> References: <20200807111555.11169-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-07_06:2020-08-06,2020-08-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=1 bulkscore=0 clxscore=1015 spamscore=0 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008070079 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Sometimes we need to do cleanup which we don't necessarily want to add to interrupt.c, so let's add a way to register a cleanup function. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/asm/interrupt.h | 1 + lib/s390x/interrupt.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h index 4cfade9..2772e6b 100644 --- a/lib/s390x/asm/interrupt.h +++ b/lib/s390x/asm/interrupt.h @@ -15,6 +15,7 @@ #define EXT_IRQ_EXTERNAL_CALL 0x1202 #define EXT_IRQ_SERVICE_SIG 0x2401 +void register_pgm_cleanup_func(void (*f)(void)); void handle_pgm_int(void); void handle_ext_int(void); void handle_mcck_int(void); diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 243b9c2..a074505 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -16,6 +16,7 @@ static bool pgm_int_expected; static bool ext_int_expected; +static void (*pgm_cleanup_func)(void); static struct lowcore *lc; void expect_pgm_int(void) @@ -51,6 +52,11 @@ void check_pgm_int_code(uint16_t code) lc->pgm_int_code); } +void register_pgm_cleanup_func(void (*f)(void)) +{ + pgm_cleanup_func = f; +} + static void fixup_pgm_int(void) { switch (lc->pgm_int_code) { @@ -115,7 +121,11 @@ void handle_pgm_int(void) } pgm_int_expected = false; - fixup_pgm_int(); + + if (pgm_cleanup_func) + (*pgm_cleanup_func)(); + else + fixup_pgm_int(); } void handle_ext_int(void) -- 2.25.1