All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] iio: adc: xilinx: Check for return values in clk related functions
From: Manish Narani @ 2018-07-23 15:02 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1532358123-23485-1-git-send-email-manish.narani@xilinx.com>

This patch adds check for return values from clock related functions.
This was reported by static code analysis tool.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 0127e85..23395fc 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -340,6 +340,8 @@ static int xadc_zynq_setup(struct platform_device *pdev,
 	xadc->zynq_intmask = ~0;
 
 	pcap_rate = clk_get_rate(xadc->clk);
+	if (!pcap_rate)
+		return -EINVAL;
 
 	if (tck_rate > pcap_rate / 2) {
 		div = 2;
@@ -887,6 +889,9 @@ static int xadc_write_raw(struct iio_dev *indio_dev,
 	unsigned long clk_rate = xadc_get_dclk_rate(xadc);
 	unsigned int div;
 
+	if (!clk_rate)
+		return -EINVAL;
+
 	if (info != IIO_CHAN_INFO_SAMP_FREQ)
 		return -EINVAL;
 
@@ -1237,8 +1242,10 @@ static int xadc_probe(struct platform_device *pdev)
 		goto err_free_irq;
 
 	/* Disable all alarms */
-	xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
-		XADC_CONF1_ALARM_MASK);
+	ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
+				  XADC_CONF1_ALARM_MASK);
+	if (ret)
+		goto err_free_irq;
 
 	/* Set thresholds to min/max */
 	for (i = 0; i < 16; i++) {
-- 
2.1.1

^ permalink raw reply related

* [PATCH 05/10] NFC: st95hf: remove exchange_lock
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

This patch removes the exchange_lock sempahore. Its intended function
was two-fold:

a) Lock the remove() callback of the driver against the ISR, so that
   the resources only go away after the ISR has finished. This is
   unnecessary though, because `rm_lock' does that already, in
   combination with the nullification of `scontext->ddev'.

b) Indicate whether a command was sent previously. If the semaphore
   is found unused in the threaded ISR, an error is reported.
   This case can be handled much nicer by checking whether `skb_resp'
   is present in the context. For this, nullify the `skb_resp' pointer
   in the callback context.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/core.c | 52 +++++++--------------------------------
 1 file changed, 9 insertions(+), 43 deletions(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index d857197ec7b2..6761ab90f68d 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -214,8 +214,6 @@ struct st95_digital_cmd_complete_arg {
  * @st95hf_supply: regulator "consumer" for NFC device.
  * @sendrcv_trflag: last byte of frame send by sendrecv command
  *	of st95hf. This byte contains transmission flag info.
- * @exchange_lock: semaphore used for signaling the st95hf_remove
- *	function that the last outstanding async nfc request is finished.
  * @rm_lock: mutex for ensuring safe access of nfc digital object
  *	from threaded ISR. Usage of this mutex avoids any race between
  *	deletion of the object from st95hf_remove() and its access from
@@ -233,7 +231,6 @@ struct st95hf_context {
 	struct st95_digital_cmd_complete_arg complete_cb_arg;
 	struct regulator *st95hf_supply;
 	unsigned char sendrcv_trflag;
-	struct semaphore exchange_lock;
 	struct mutex rm_lock;
 	u8 current_protocol;
 	u8 current_rf_tech;
@@ -785,29 +782,14 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 	struct st95_digital_cmd_complete_arg *cb_arg;
 
 	spidevice = &stcontext->spicontext.spidev->dev;
+	cb_arg = &stcontext->complete_cb_arg;
+	skb_resp = cb_arg->skb_resp;
 
-	/*
-	 * check semaphore, if not down() already, then we don't
-	 * know in which context the ISR is called and surely it
-	 * will be a bug. Note that down() of the semaphore is done
-	 * in the corresponding st95hf_in_send_cmd() and then
-	 * only this ISR should be called. ISR will up() the
-	 * semaphore before leaving. Hence when the ISR is called
-	 * the correct behaviour is down_trylock() should always
-	 * return 1 (indicating semaphore cant be taken and hence no
-	 * change in semaphore count).
-	 * If not, then we up() the semaphore and crash on
-	 * a BUG() !
-	 */
-	if (!down_trylock(&stcontext->exchange_lock)) {
-		up(&stcontext->exchange_lock);
+	if (unlikely(!skb_resp)) {
 		WARN(1, "unknown context in ST95HF ISR");
 		return IRQ_NONE;
 	}
 
-	cb_arg = &stcontext->complete_cb_arg;
-	skb_resp = cb_arg->skb_resp;
-
 	mutex_lock(&stcontext->rm_lock);
 	res_len = st95hf_spi_recv_response(&stcontext->spicontext,
 					   skb_resp->data);
@@ -856,8 +838,13 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 	/* call digital layer callback */
 	cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp);
 
+	/*
+	 * This skb is now owned by the core layer.
+	 * Make sure not to use it again.
+	 */
+	cb_arg->skb_resp = NULL;
+
 	/* up the semaphore before returning */
-	up(&stcontext->exchange_lock);
 	mutex_unlock(&stcontext->rm_lock);
 
 	return IRQ_HANDLED;
@@ -868,8 +855,6 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 	skb_resp = ERR_PTR(result);
 	/* call of callback with error */
 	cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp);
-	/* up the semaphore before returning */
-	up(&stcontext->exchange_lock);
 	mutex_unlock(&stcontext->rm_lock);
 	return IRQ_HANDLED;
 }
@@ -965,25 +950,12 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 	    ddev->curr_protocol == NFC_PROTO_ISO14443)
 		stcontext->complete_cb_arg.rats = true;
 
-	/*
-	 * down the semaphore to indicate to remove func that an
-	 * ISR is pending, note that it will not block here in any case.
-	 * If found blocked, it is a BUG!
-	 */
-	rc = down_killable(&stcontext->exchange_lock);
-	if (rc) {
-		WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n");
-		return rc;
-	}
-
 	rc = st95hf_spi_send(&stcontext->spicontext, skb->data,
 			     skb->len,
 			     ASYNC);
 	if (rc) {
 		dev_err(&stcontext->nfcdev->dev,
 			"Error %d trying to perform data_exchange", rc);
-		/* up the semaphore since ISR will never come in this case */
-		up(&stcontext->exchange_lock);
 		goto free_skb_resp;
 	}
 
@@ -1104,7 +1076,6 @@ static int st95hf_probe(struct spi_device *nfc_spi_dev)
 		}
 	}
 
-	sema_init(&st95context->exchange_lock, 1);
 	init_completion(&spicontext->done);
 	mutex_init(&spicontext->spi_lock);
 	mutex_init(&st95context->rm_lock);
@@ -1220,11 +1191,6 @@ static int st95hf_remove(struct spi_device *nfc_spi_dev)
 
 	mutex_unlock(&stcontext->rm_lock);
 
-	/* if last in_send_cmd's ISR is pending, wait for it to finish */
-	result = down_killable(&stcontext->exchange_lock);
-	if (result == -EINTR)
-		dev_err(&spictx->spidev->dev, "sleep for semaphore interrupted by signal\n");
-
 	/* next reset the ST95HF controller */
 	result = st95hf_spi_send(&stcontext->spicontext,
 				 &reset_cmd,
-- 
2.17.1

^ permalink raw reply related

* [PATCH 06/10] NFC: st95hf: move skb allocation to ISR
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

The driver currently assumes that interrupts can only occur between the
time when when a command has been sent to the device and the response
to it.

This assumption, however, is wrong. The antenna of the chip is likely to
catch a lot of environmental noise, and once in a while, the device will
latch the interrupt to signal a protocol error, and keep it latched until
the response bytes are read from the chip.

As the code currently stands, skbs for responses are only prepared when
a command is sent, and the ISR bails out early if that wasn't the case.
Hence, the interrupt remains latched, and no further communication with
device is possible.

To fix this, move the call to nfc_alloc_recv_skb() from
st95hf_in_send_cmd() to st95hf_irq_thread_handler() so we can always read
back the interrupt reason.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/core.c | 36 ++++++------------------------------
 1 file changed, 6 insertions(+), 30 deletions(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 6761ab90f68d..99f84ddfdfef 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -196,7 +196,6 @@ static const struct cmd cmd_array[] = {
 
 /* st95_digital_cmd_complete_arg stores client context */
 struct st95_digital_cmd_complete_arg {
-	struct sk_buff *skb_resp;
 	nfc_digital_cmd_complete_t complete_cb;
 	void *cb_usrarg;
 	bool rats;
@@ -783,12 +782,10 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 
 	spidevice = &stcontext->spicontext.spidev->dev;
 	cb_arg = &stcontext->complete_cb_arg;
-	skb_resp = cb_arg->skb_resp;
 
-	if (unlikely(!skb_resp)) {
-		WARN(1, "unknown context in ST95HF ISR");
+	skb_resp = nfc_alloc_recv_skb(MAX_RESPONSE_BUFFER_SIZE, GFP_KERNEL);
+	if (WARN_ON(!skb_resp))
 		return IRQ_NONE;
-	}
 
 	mutex_lock(&stcontext->rm_lock);
 	res_len = st95hf_spi_recv_response(&stcontext->spicontext,
@@ -838,12 +835,6 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 	/* call digital layer callback */
 	cb_arg->complete_cb(stcontext->ddev, cb_arg->cb_usrarg, skb_resp);
 
-	/*
-	 * This skb is now owned by the core layer.
-	 * Make sure not to use it again.
-	 */
-	cb_arg->skb_resp = NULL;
-
 	/* up the semaphore before returning */
 	mutex_unlock(&stcontext->rm_lock);
 
@@ -913,15 +904,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 			      void *arg)
 {
 	struct st95hf_context *stcontext = nfc_digital_get_drvdata(ddev);
-	int rc;
-	struct sk_buff *skb_resp;
-	int len_data_to_tag = 0;
-
-	skb_resp = nfc_alloc_recv_skb(MAX_RESPONSE_BUFFER_SIZE, GFP_KERNEL);
-	if (!skb_resp) {
-		rc = -ENOMEM;
-		goto error;
-	}
+	int rc, len_data_to_tag = 0;
 
 	switch (stcontext->current_rf_tech) {
 	case NFC_DIGITAL_RF_TECH_106A:
@@ -933,8 +916,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 		len_data_to_tag = skb->len;
 		break;
 	default:
-		rc = -EINVAL;
-		goto free_skb_resp;
+		return -EINVAL;
 	}
 
 	skb_push(skb, 3);
@@ -942,7 +924,6 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 	skb->data[1] = SEND_RECEIVE_CMD;
 	skb->data[2] = len_data_to_tag;
 
-	stcontext->complete_cb_arg.skb_resp = skb_resp;
 	stcontext->complete_cb_arg.cb_usrarg = arg;
 	stcontext->complete_cb_arg.complete_cb = cb;
 
@@ -956,17 +937,12 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 	if (rc) {
 		dev_err(&stcontext->nfcdev->dev,
 			"Error %d trying to perform data_exchange", rc);
-		goto free_skb_resp;
+		return rc;
 	}
 
 	kfree_skb(skb);
 
-	return rc;
-
-free_skb_resp:
-	kfree_skb(skb_resp);
-error:
-	return rc;
+	return 0;
 }
 
 /* p2p will be supported in a later release ! */
-- 
2.17.1

^ permalink raw reply related

* [PATCH 07/10] NFC: st95hf: re-order command defines
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

Just a small cleanup to bring the command defines in a numerical order.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 99f84ddfdfef..e7ecc57dde8f 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -45,10 +45,10 @@
 
 /* Command Send Interface */
 /* ST95HF_COMMAND_SEND CMD Ids */
-#define ECHO_CMD			0x55
-#define WRITE_REGISTER_CMD		0x9
 #define PROTOCOL_SELECT_CMD		0x2
 #define SEND_RECEIVE_CMD		0x4
+#define WRITE_REGISTER_CMD		0x9
+#define ECHO_CMD			0x55
 
 /* Select protocol codes */
 #define ISO15693_PROTOCOL_CODE		0x1
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 1/4] iio: adc: xilinx: Check for return values in clk related functions
From: Manish Narani @ 2018-07-23 15:02 UTC (permalink / raw)
  To: lakshmi.sai.krishna.potthuri, manish.narani, michal.simek, pmeerw,
	lars, knaack.h, jic23
  Cc: anirudh, sgoud, linux-kernel, linux-arm-kernel, linux-iio
In-Reply-To: <1532358123-23485-1-git-send-email-manish.narani@xilinx.com>

This patch adds check for return values from clock related functions.
This was reported by static code analysis tool.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 0127e85..23395fc 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -340,6 +340,8 @@ static int xadc_zynq_setup(struct platform_device *pdev,
 	xadc->zynq_intmask = ~0;
 
 	pcap_rate = clk_get_rate(xadc->clk);
+	if (!pcap_rate)
+		return -EINVAL;
 
 	if (tck_rate > pcap_rate / 2) {
 		div = 2;
@@ -887,6 +889,9 @@ static int xadc_write_raw(struct iio_dev *indio_dev,
 	unsigned long clk_rate = xadc_get_dclk_rate(xadc);
 	unsigned int div;
 
+	if (!clk_rate)
+		return -EINVAL;
+
 	if (info != IIO_CHAN_INFO_SAMP_FREQ)
 		return -EINVAL;
 
@@ -1237,8 +1242,10 @@ static int xadc_probe(struct platform_device *pdev)
 		goto err_free_irq;
 
 	/* Disable all alarms */
-	xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
-		XADC_CONF1_ALARM_MASK);
+	ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
+				  XADC_CONF1_ALARM_MASK);
+	if (ret)
+		goto err_free_irq;
 
 	/* Set thresholds to min/max */
 	for (i = 0; i < 16; i++) {
-- 
2.1.1

^ permalink raw reply related

* [PATCH v2 0/4] iio: adc: xilinx: XADC driver Enhancements and bug fixes
From: Manish Narani @ 2018-07-23 15:01 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series resolves code style problems as reported by code analysis
tools.

Changes in v2:
	- From the first version of patches, 2 patches are dropped in this
	  series.
	- In the v1 patch set, 1/4 was not required as the issue is in
	  checkpatch.pl script and not in the code.
	- In the v1 patch set 2/4 was applied on togreg branch of iio.git
	- for 3/4 patch in v1 patch set, the patch is broken up in 2 patches
	  in this series as per review comments. They are now 1/4 and 2/4 in
	  this series.
	- 4/4 patch in the v1 patch set was basically to resolve coverity
	  warning for platform_get_irq() in xadc_remove function, but that was
	  causing potential race condition. Fixed that in this series (3/4).
	- A new patch is added in this series for moving request_irq() before
	  enabling interrupts.


Manish Narani (4):
  iio: adc: xilinx: Check for return values in clk related functions
  iio: adc: xilinx: limit pcap clock frequency value
  iio: adc: xilinx: Remove platform_get_irq from xadc_remove function
  iio: adc: xilinx: Move request_irq before enabling interrupts

 drivers/iio/adc/xilinx-xadc-core.c | 40 +++++++++++++++++++++++++++++---------
 drivers/iio/adc/xilinx-xadc.h      |  1 +
 2 files changed, 32 insertions(+), 9 deletions(-)

-- 
2.1.1

^ permalink raw reply

* [PATCH 04/10] NFC: st95hf: remove logging from spi functions
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

The callers of these functions already log errors, so there's no need to do
it from two places.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/spi.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/nfc/st95hf/spi.c b/drivers/nfc/st95hf/spi.c
index e2d3bbcc8c34..d5894d4546b1 100644
--- a/drivers/nfc/st95hf/spi.c
+++ b/drivers/nfc/st95hf/spi.c
@@ -47,8 +47,6 @@ int st95hf_spi_send(struct st95hf_spi_context *spicontext,
 
 	result = spi_sync(spidev, &m);
 	if (result) {
-		dev_err(&spidev->dev, "error: sending cmd to st95hf using SPI = %d\n",
-			result);
 		mutex_unlock(&spicontext->spi_lock);
 		return result;
 	}
@@ -62,12 +60,10 @@ int st95hf_spi_send(struct st95hf_spi_context *spicontext,
 	result = wait_for_completion_timeout(&spicontext->done,
 					     msecs_to_jiffies(1000));
 	/* check for timeout or success */
-	if (!result) {
-		dev_err(&spidev->dev, "error: response not ready timeout\n");
+	if (!result)
 		result = -ETIMEDOUT;
-	} else {
+	else
 		result = 0;
-	}
 
 	mutex_unlock(&spicontext->spi_lock);
 
@@ -79,7 +75,7 @@ EXPORT_SYMBOL_GPL(st95hf_spi_send);
 int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
 			     unsigned char *receivebuff)
 {
-	int len = 0;
+	int ret, len;
 	struct spi_transfer tx_takedata;
 	struct spi_message m;
 	struct spi_device *spidev = spicontext->spidev;
@@ -89,8 +85,6 @@ int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
 		{.rx_buf = receivebuff, .len = 2, .cs_change = 1,},
 	};
 
-	int ret = 0;
-
 	memset(&tx_takedata, 0x0, sizeof(struct spi_transfer));
 
 	mutex_lock(&spicontext->spi_lock);
@@ -102,8 +96,6 @@ int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
 
 	ret = spi_sync(spidev, &m);
 	if (ret) {
-		dev_err(&spidev->dev, "spi_recv_resp, data length error = %d\n",
-			ret);
 		mutex_unlock(&spicontext->spi_lock);
 		return ret;
 	}
@@ -127,11 +119,8 @@ int st95hf_spi_recv_response(struct st95hf_spi_context *spicontext,
 	ret = spi_sync(spidev, &m);
 
 	mutex_unlock(&spicontext->spi_lock);
-	if (ret) {
-		dev_err(&spidev->dev, "spi_recv_resp, data read error = %d\n",
-			ret);
+	if (ret)
 		return ret;
-	}
 
 	return len;
 }
-- 
2.17.1

^ permalink raw reply related

* [PATCH 03/10] NFC: st95hf: drop illegal kfree_skb() in IRQ handler
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

In the error path of the IRQ handler, don't free the skb in flight. The
callback in the digital core will do that for us. Doing it from both
places causes memory corruptions.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index d58424ab5c48..d857197ec7b2 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -863,7 +863,6 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 	return IRQ_HANDLED;
 
 end:
-	kfree_skb(skb_resp);
 	wtx = false;
 	cb_arg->rats = false;
 	skb_resp = ERR_PTR(result);
-- 
2.17.1

^ permalink raw reply related

* [PATCH 02/10] NFC: st95hf: drop nfcdev_free
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

This flag is unneccesary. We can just nullify `ddev' instead after we freed
it.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/nfc/st95hf/core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index bc1a2070f9bb..d58424ab5c48 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -220,8 +220,6 @@ struct st95_digital_cmd_complete_arg {
  *	from threaded ISR. Usage of this mutex avoids any race between
  *	deletion of the object from st95hf_remove() and its access from
  *	the threaded ISR.
- * @nfcdev_free: flag to have the state of nfc device object.
- *	[alive | died]
  * @current_protocol: current nfc protocol.
  * @current_rf_tech: current rf technology.
  * @fwi: frame waiting index, received in reply of RATS according to
@@ -237,7 +235,6 @@ struct st95hf_context {
 	unsigned char sendrcv_trflag;
 	struct semaphore exchange_lock;
 	struct mutex rm_lock;
-	bool nfcdev_free;
 	u8 current_protocol;
 	u8 current_rf_tech;
 	int fwi;
@@ -820,8 +817,8 @@ static irqreturn_t st95hf_irq_thread_handler(int irq, void  *st95hfcontext)
 		goto end;
 	}
 
-	/* if stcontext->nfcdev_free is true, it means remove already ran */
-	if (stcontext->nfcdev_free) {
+	/* if stcontext->ddev is %NULL, it means remove already ran */
+	if (!stcontext->ddev) {
 		result = -ENODEV;
 		goto end;
 	}
@@ -1220,7 +1217,7 @@ static int st95hf_remove(struct spi_device *nfc_spi_dev)
 
 	nfc_digital_unregister_device(stcontext->ddev);
 	nfc_digital_free_device(stcontext->ddev);
-	stcontext->nfcdev_free = true;
+	stcontext->ddev = NULL;
 
 	mutex_unlock(&stcontext->rm_lock);
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH 01/10] Revert "NFC: st95hf: drop illegal kfree_skb()"
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack
In-Reply-To: <20180723140015.11663-1-daniel@zonque.org>

This reverts commit c99f996b2ba49 ("NFC: st95hf: drop illegal
kfree_skb()").

It turns out that the st95hf_in_send_cmd() is in fact the sole owner of
this skb, and by not freeing it here, we not only causing a memory leak
but also mess up the refcount of the socket that holds it. This will in
turn lead to activated targets not being cleaned up, even after
stopping userspace processes.

The memory corruption that I was hunting was caused by another
kfree_skb(). This will be fixed in a later commit.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Fixes: c99f996b2ba49 ("NFC: st95hf: drop illegal kfree_skb()")
---
 drivers/nfc/st95hf/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 36ef0e905ba3..bc1a2070f9bb 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -991,6 +991,8 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 		goto free_skb_resp;
 	}
 
+	kfree_skb(skb);
+
 	return rc;
 
 free_skb_resp:
-- 
2.17.1

^ permalink raw reply related

* [PATCH 00/10] NFC: A bunch of cleanups for st95hf
From: Daniel Mack @ 2018-07-23 14:00 UTC (permalink / raw)
  To: sameo; +Cc: linux-wireless, colin.king, shikha.singh, Daniel Mack

This is a series of patches for the ST95HF driver.

Patch #1 reverts a change that I have submitted earlier and which is
sitting in nfc-next already. Given that the tree hasn't been sent out
for being merged yet, it could also still be removed with rebasing, in
which case #1 is not necessary of course.

The changes are all rather simple and are explained in their individual
commit logs.

Note that this series builds upon the patch titled "nfc: st95hf: remove
redundant pointers 'dev' and 'nfcddev'" that Colin posted the other day.


Thanks,
Daniel

Daniel Mack (10):
  Revert "NFC: st95hf: drop illegal kfree_skb()"
  NFC: st95hf: drop nfcdev_free
  NFC: st95hf: drop illegal kfree_skb() in IRQ handler
  NFC: st95hf: remove logging from spi functions
  NFC: st95hf: remove exchange_lock
  NFC: st95hf: move skb allocation to ISR
  NFC: st95hf: re-order command defines
  NFC: st95hf: unify sync/async flags
  NFC: st95hf: two small style nits
  NFC: st95hf: add of match table

 drivers/nfc/st95hf/core.c | 135 +++++++++++---------------------------
 drivers/nfc/st95hf/spi.c  |  31 +++------
 drivers/nfc/st95hf/spi.h  |   8 +--
 3 files changed, 49 insertions(+), 125 deletions(-)

-- 
2.17.1

^ permalink raw reply

* [PATCH] staging: gasket: use vzalloc instead of vmalloc/memset
From: Ivan Bornyakov @ 2018-07-23 15:05 UTC (permalink / raw)
  To: devel; +Cc: linux-kernel, gregkh, benchan, jnjoseph, rspringer,
	Ivan Bornyakov

Signed-off-by: Ivan Bornyakov <brnkv.i1@gmail.com>
---
 drivers/staging/gasket/gasket_page_table.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index 9f8116112e0a..3ffc8d67ec05 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -330,7 +330,7 @@ int gasket_page_table_init(
 	pg_tbl = *ppg_tbl;
 	bytes = total_entries * sizeof(struct gasket_page_table_entry);
 	if (bytes != 0) {
-		pg_tbl->entries = vmalloc(bytes);
+		pg_tbl->entries = vzalloc(bytes);
 		if (!pg_tbl->entries) {
 			gasket_nodev_error(
 				"No memory for address translation metadata.");
@@ -338,7 +338,6 @@ int gasket_page_table_init(
 			*ppg_tbl = NULL;
 			return -ENOMEM;
 		}
-		memset(pg_tbl->entries, 0, bytes);
 	}
 
 	mutex_init(&pg_tbl->mutex);
@@ -1067,13 +1066,12 @@ static int gasket_alloc_extended_subtable(
 
 	subtable_bytes = sizeof(struct gasket_page_table_entry) *
 		GASKET_PAGES_PER_SUBTABLE;
-	pte->sublevel = vmalloc(subtable_bytes);
+	pte->sublevel = vzalloc(subtable_bytes);
 	if (!pte->sublevel) {
 		free_page(page_addr);
 		memset(pte, 0, sizeof(struct gasket_page_table_entry));
 		return -ENOMEM;
 	}
-	memset(pte->sublevel, 0, subtable_bytes);
 
 	/* Map the page into DMA space. */
 	if (pg_tbl->dma_ops) {
-- 
2.16.4


^ permalink raw reply related

* Re: [stable-4.14 00/23] block/scsi multiqueue performance enhancement and
From: Jack Wang @ 2018-07-23 15:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-scsi, linux-block, Jens Axboe
  Cc: Wang Jinpu, stable, Jinpu Wang
In-Reply-To: <20180723133356.GA1333@kroah.com>

Hi Greg,

Thanks for quick reply. Please see reply inline.



Greg KH <gregkh@linuxfoundation.org> 于2018年7月23日周一 下午3:34写道:
>
> On Mon, Jul 23, 2018 at 03:24:22PM +0200, Jack Wang wrote:
> > Hi Greg,
> >
> > Please consider this patchset, which include block/scsi multiqueue performance
> > enhancement and bugfix.
>
> What exactly is the performance enhancement?  How can you measure it?
> How did you measure it?
I'm testing on SRP/IBNBD using fio, I've seen +10% with mix IO load,
and 50% improvement on small IO (bs=512.) with the patchset.

>
> Which one(s) are the bugfixes in this series?  Why not just submit those
> separately as they should be "obvious fixes", right?
We had queue stall problem on shared hctx restart, my colleague Roman
reported to upstream:
https://lkml.org/lkml/2017/10/18/263
the patch wasn't taken by upstream, and a bigger patchset from Lei
Ming was accepted instread with revert and further bugfix later on.

following patches meant for improving performance on scsi-mq, and also
contains the attempt to fix the queue stall problem
 358a3a6bccb7 ("blk-mq: don't handle TAG_SHARED in restart")
  blk-mq-sched: move actual dispatching into one helper
  blk-mq: introduce .get_budget and .put_budget in blk_mq_ops
  sbitmap: introduce __sbitmap_for_each_set()
  blk-mq-sched: improve dispatching from sw queue
  scsi: allow passing in null rq to scsi_prep_state_check()
  scsi: implement .get_budget and .put_budget for blk-mq
  SCSI: don't get target/host busy_count in scsi_mq_get_budget()
  blk-mq: don't handle TAG_SHARED in restart
  blk-mq: don't restart queue when .get_budget returns BLK_STS_RESOURCE
  blk-mq: don't handle failure in .get_budget

Following is independent fix:
blk-mq: quiesce queue during switching io sched and updating nr_requests
blk-mq: fix issue with shared tag queue re-running

These are clearup for flush request handling:
  blk-flush: don't run queue for requests bypassing flush
  block: pass 'run_queue' to blk_mq_request_bypass_insert
  blk-flush: use blk_mq_request_bypass_insert()
  blk-mq-sched: decide how to handle flush rq via RQF_FLUSH_SEQ
  blk-mq: move blk_mq_put_driver_tag*() into blk-mq.h
  blk-mq: don't allocate driver tag upfront for flush rq

The left are following up fixes.
>
> And why didn't you cc: the subsystem maintainer and mailing list here?
> I need their ack before I could take these.
Sorry, my mistake, now add Jens, linux-block, ilnux-scsi in reply.

Sorry for confusion.
>
> thanks,
>
> greg k-h

Regards,
Jack Wang

^ permalink raw reply

* Re: [stable-4.14 00/23] block/scsi multiqueue performance enhancement and
From: Jack Wang @ 2018-07-23 15:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-scsi, linux-block, Jens Axboe
  Cc: Wang Jinpu, stable, Jinpu Wang
In-Reply-To: <20180723133356.GA1333@kroah.com>

Hi Greg,

Thanks for quick reply. Please see reply inline.



Greg KH <gregkh@linuxfoundation.org> =E4=BA=8E2018=E5=B9=B47=E6=9C=8823=E6=
=97=A5=E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=883:34=E5=86=99=E9=81=93=EF=BC=9A
>
> On Mon, Jul 23, 2018 at 03:24:22PM +0200, Jack Wang wrote:
> > Hi Greg,
> >
> > Please consider this patchset, which include block/scsi multiqueue perf=
ormance
> > enhancement and bugfix.
>
> What exactly is the performance enhancement?  How can you measure it?
> How did you measure it?
I'm testing on SRP/IBNBD using fio, I've seen +10% with mix IO load,
and 50% improvement on small IO (bs=3D512.) with the patchset.

>
> Which one(s) are the bugfixes in this series?  Why not just submit those
> separately as they should be "obvious fixes", right?
We had queue stall problem on shared hctx restart, my colleague Roman
reported to upstream:
https://lkml.org/lkml/2017/10/18/263
the patch wasn't taken by upstream, and a bigger patchset from Lei
Ming was accepted instread with revert and further bugfix later on.

following patches meant for improving performance on scsi-mq, and also
contains the attempt to fix the queue stall problem
 358a3a6bccb7 ("blk-mq: don't handle TAG_SHARED in restart")
  blk-mq-sched: move actual dispatching into one helper
  blk-mq: introduce .get_budget and .put_budget in blk_mq_ops
  sbitmap: introduce __sbitmap_for_each_set()
  blk-mq-sched: improve dispatching from sw queue
  scsi: allow passing in null rq to scsi_prep_state_check()
  scsi: implement .get_budget and .put_budget for blk-mq
  SCSI: don't get target/host busy_count in scsi_mq_get_budget()
  blk-mq: don't handle TAG_SHARED in restart
  blk-mq: don't restart queue when .get_budget returns BLK_STS_RESOURCE
  blk-mq: don't handle failure in .get_budget

Following is independent fix:
blk-mq: quiesce queue during switching io sched and updating nr_requests
blk-mq: fix issue with shared tag queue re-running

These are clearup for flush request handling:
  blk-flush: don't run queue for requests bypassing flush
  block: pass 'run_queue' to blk_mq_request_bypass_insert
  blk-flush: use blk_mq_request_bypass_insert()
  blk-mq-sched: decide how to handle flush rq via RQF_FLUSH_SEQ
  blk-mq: move blk_mq_put_driver_tag*() into blk-mq.h
  blk-mq: don't allocate driver tag upfront for flush rq

The left are following up fixes.
>
> And why didn't you cc: the subsystem maintainer and mailing list here?
> I need their ack before I could take these.
Sorry, my mistake, now add Jens, linux-block, ilnux-scsi in reply.

Sorry for confusion.
>
> thanks,
>
> greg k-h

Regards,
Jack Wang

^ permalink raw reply

* Re: [PATCH 3/4] perf/x86/intel/ds: Handle PEBS overflow for fixed counters
From: Peter Zijlstra @ 2018-07-23 14:59 UTC (permalink / raw)
  To: kan.liang
  Cc: tglx, mingo, linux-kernel, acme, alexander.shishkin,
	vincent.weaver, jolsa, ak
In-Reply-To: <20180309021542.11374-3-kan.liang@linux.intel.com>

On Thu, Mar 08, 2018 at 06:15:41PM -0800, kan.liang@linux.intel.com wrote:
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index ef47a418d819..86149b87cce8 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -2280,7 +2280,10 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
>  	 * counters from the GLOBAL_STATUS mask and we always process PEBS
>  	 * events via drain_pebs().
>  	 */
> -	status &= ~(cpuc->pebs_enabled & PEBS_COUNTER_MASK);
> +	if (x86_pmu.flags & PMU_FL_PEBS_ALL)
> +		status &= ~(cpuc->pebs_enabled & EXTENDED_PEBS_COUNTER_MASK);
> +	else
> +		status &= ~(cpuc->pebs_enabled & PEBS_COUNTER_MASK);
>  
>  	/*
>  	 * PEBS overflow sets bit 62 in the global status register

Doesn't this re-introduce the problem fixed in commit fd583ad1563be,
where pebs_enabled:32-34 are PEBS Load Latency, instead of fixed
counters?

^ permalink raw reply

* Re: [PATCH v1] earlyprintk configuration for rk3399 boards
From: Julien Grall @ 2018-07-23 14:59 UTC (permalink / raw)
  To: Ihor Matushchak
  Cc: xen-devel, Stefano Stabellini,
	Ігор Матущак,
	xen-devel
In-Reply-To: <CAFq70MG5aKTHYGjEom4HUzJKshkVPd6PScv2JV7H-ygmiZu=Lg@mail.gmail.com>



On 23/07/18 15:47, Ihor Matushchak wrote:
> Hi Julien,

Hi Ihor,

> 
> Sure, I would be glad to do that.
> 
> I suppose it should be placed somewhere on wiki.xenproject.org 
> <http://wiki.xenproject.org>?

We usually create a new platform under 
https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions

We can then add a link on the main page to the documentation of the rk3399.

Cheers,

> /
> /
> /BR,/
> /Ihor Matushchak/
> 
> 2018-07-23 17:33 GMT+03:00 Julien Grall <julien.grall@arm.com 
> <mailto:julien.grall@arm.com>>:
> 
>     On 06/07/18 12:04, Ігор Матущак wrote:
> 
>         Hello Julien,
> 
> 
>     Hi Ihor,
> 
>     Sorry for the late reply.
> 
> 
>         I suppose there is no such documentation, at least I didn't find
>         any.
>         Bringing up XEN 4.10.0 on RK3399 is my pet-project.
>         My current target board is Ibox3399
>         <https://www.aliexpress.com/item/RK3399-Development-Board-Ibox3399-2GB-DDR3-16GB-EMMC-Six-Core-A72-A53-Mali-T860-GPU-Android6/32816273232.html
>         <https://www.aliexpress.com/item/RK3399-Development-Board-Ibox3399-2GB-DDR3-16GB-EMMC-Six-Core-A72-A53-Mali-T860-GPU-Android6/32816273232.html>>
> 
>         At the moment I got dom0 running on this board and some test
>         guest domain (both 4.4 kernels).
>         Actually no changes made to XEN (except earlyprintk) at the
>         moment, Xen works from the box.
> 
> 
>     Glad to see Xen booting out of box on RK3399 :).
> 
>     The alias is only for convience. It would be possible to do the same
>     with 8250,0xff1a0000,2.
> 
>     So instead of that patch, I would suggest to write down a
>     documentation for booting Xen on the board and early debugging.
> 
>     What do you think?
> 
>     Cheers,
> 
> 
>         /BR,/
>         /Ihor Matushchak/
> 
>         2018-07-06 13:36 GMT+03:00 Julien Grall <julien.grall@arm.com
>         <mailto:julien.grall@arm.com> <mailto:julien.grall@arm.com
>         <mailto:julien.grall@arm.com>>>:
> 
>              Hello,
> 
>              On 04/07/18 21:55, ihor.matushchak@foobox.net
>         <mailto:ihor.matushchak@foobox.net>
>              <mailto:ihor.matushchak@foobox.net
>         <mailto:ihor.matushchak@foobox.net>> wrote:
> 
>                  From: Ihor Matushchak <ihor.matushchak@foobox.net
>         <mailto:ihor.matushchak@foobox.net>
>                  <mailto:ihor.matushchak@foobox.net
>         <mailto:ihor.matushchak@foobox.net>>>
> 
>                  This patch enables earlyprintk for Rockchip rk3399
>         based SoC.
> 
>              Is there any missing pieces in Xen to boot on Rockchip? I
>         would also
>              quite like to see some documentation how to boot Xen on
>         that platform.
> 
>              Cheers,
> 
> 
> 
>                  Ihor Matushchak (1):
>                      xen:arm:earlyprintk configuration for rk3399 boards
> 
>                     docs/misc/arm/early-printk.txt | 1 +
>                     xen/arch/arm/Rules.mk          | 1 +
>                     2 files changed, 2 insertions(+)
> 
> 
>              --     Julien Grall
> 
> 
> 
>     -- 
>     Julien Grall
> 
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply

* [PATCH -next v2] regmap: sccb: fix typo and sort headers alphabetically
From: Akinobu Mita @ 2018-07-23 14:59 UTC (permalink / raw)
  To: linux-media, linux-i2c, linux-kernel
  Cc: Akinobu Mita, Wolfram Sang, Mark Brown

Fix typos 's/wit/with/' in the comments and sort headers alphabetically
in order to avoid duplicate includes in future.

Fixes: bcf7eac3d97f ("regmap: add SCCB support")
Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Mark Brown <broonie@kernel.org>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
* v2
- Replace Wolfram's address for Reported-by tag
- Add Reviewed-by tag

 drivers/base/regmap/regmap-sccb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap-sccb.c b/drivers/base/regmap/regmap-sccb.c
index b6eb876..597042e2 100644
--- a/drivers/base/regmap/regmap-sccb.c
+++ b/drivers/base/regmap/regmap-sccb.c
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 // Register map access API - SCCB support
 
-#include <linux/regmap.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
+#include <linux/regmap.h>
 
 #include "internal.h"
 
@@ -29,7 +29,7 @@ static bool sccb_is_available(struct i2c_adapter *adap)
 
 /**
  * regmap_sccb_read - Read data from SCCB slave device
- * @context: Device that will be interacted wit
+ * @context: Device that will be interacted with
  * @reg: Register to be read from
  * @val: Pointer to store read value
  *
@@ -65,7 +65,7 @@ static int regmap_sccb_read(void *context, unsigned int reg, unsigned int *val)
 
 /**
  * regmap_sccb_write - Write data to SCCB slave device
- * @context: Device that will be interacted wit
+ * @context: Device that will be interacted with
  * @reg: Register to write to
  * @val: Value to be written
  *
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH 6/7] btrfs: add helper btrfs_num_devices() to deduce num_devices
From: David Sterba @ 2018-07-23 13:57 UTC (permalink / raw)
  To: Anand Jain; +Cc: dsterba, linux-btrfs
In-Reply-To: <d3fc6178-0884-28cf-ac3e-e42a00682150@oracle.com>

On Fri, Jul 20, 2018 at 07:18:54PM +0800, Anand Jain wrote:
> 
> 
> On 07/19/2018 07:53 PM, David Sterba wrote:
> > On Mon, Jul 16, 2018 at 10:58:11PM +0800, Anand Jain wrote:
> >> When the replace is running the fs_devices::num_devices also includes
> >> the replace device, however in some operations like device delete and
> >> balance it needs the actual num_devices without the repalce devices, so
> >> now the function btrfs_num_devices() just provides that.
> > 
> > We can't run any two from device delete, device replace or balance at
> > the same time.
> > 
> >>
> >> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> >> ---
> >> v2: add comments. Thanks Nikolay.
> >>
> >>   fs/btrfs/volumes.c | 32 ++++++++++++++++++--------------
> >>   1 file changed, 18 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> >> index 0f4c512aa6b4..1c0b56374992 100644
> >> --- a/fs/btrfs/volumes.c
> >> +++ b/fs/btrfs/volumes.c
> >> @@ -1844,6 +1844,21 @@ void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info,
> >>   		fs_info->fs_devices->latest_bdev = next_device->bdev;
> >>   }
> >>   
> >> +/* Returns btrfs_fs_devices::num_devices excluding replace device if any */
> >> +static inline u64 btrfs_num_devices(struct btrfs_fs_info *fs_info)
> >> +{
> >> +	u64 num_devices = fs_info->fs_devices->num_devices;
> >> +
> >> +	btrfs_dev_replace_read_lock(&fs_info->dev_replace);
> >> +	if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
> >> +		WARN_ON(num_devices < 1);
> >> +		num_devices--;
> >> +	}
> >> +	btrfs_dev_replace_read_unlock(&fs_info->dev_replace);
> 
> 
> 
> > This does not make sense, besides that > btrfs_dev_replace_is_ongoing is
> > always going to be false here,
> 
>   No. There is a way how balance and replace could co-exists.
>   (theoretically, I didn't experiment it yet)
>   . Start balance and pause it
>   . Now start the replace
>   . power-fail
>   . The open_ctree() first starts the balance so it must check
>   for the replace device otherwise our num_devices calculation will
>   be wrong. IMO its not a good idea to remove the replace check here.

I see, the paused states can lead to balance that sees device replace
ongoing as true. This would be good to add to the function comment as
it's not quite obvious why the helper is needed.

>   For now a consolidation as in this patch is better.

Yeah, for this context it would be good.  The function name could be
more descriptive what devices it actually counts.

^ permalink raw reply

* [PATCH u-boot 4/4] aspeed: Disable unnecessary features
From: Andrew Jeffery @ 2018-07-23 14:58 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, openbmc
In-Reply-To: <20180723145840.17856-1-andrew@aj.id.au>

Adjust board_init() to disable hardware features that we don't need
available during normal BMC operation.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 arch/arm/include/asm/arch-aspeed/regs-lpc.h  | 29 +++++++++++++++
 arch/arm/include/asm/arch-aspeed/regs-scu.h  |  8 +++-
 arch/arm/include/asm/arch-aspeed/regs-sdmc.h |  4 ++
 board/aspeed/ast-g4/ast-g4.c                 | 33 ++++++++++++++++-
 board/aspeed/ast-g5/ast-g5.c                 | 39 +++++++++++++++++++-
 5 files changed, 110 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-aspeed/regs-lpc.h

diff --git a/arch/arm/include/asm/arch-aspeed/regs-lpc.h b/arch/arm/include/asm/arch-aspeed/regs-lpc.h
new file mode 100644
index 000000000000..b0162ae4f37c
--- /dev/null
+++ b/arch/arm/include/asm/arch-aspeed/regs-lpc.h
@@ -0,0 +1,29 @@
+/* arch/arm/mach-aspeed/include/mach/regs-sdmc.h
+ *
+ * Copyright (C) 2018  IBM Corp
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ *   History      :
+ *    1. 2018/07/23 Andrew Jeffery Create
+ *
+ ******************************************************************************/
+#ifndef __AST_REGS_LPC_H
+#define __AST_REGS_LPC_H
+
+/*
+ *  Register for LPC
+ */
+
+#define AST_LPC_HICR5		0x80
+#define AST_LPC_HICRB		0x100
+
+/*	AST_LPC_HICR5 : 0x80	Host Interface Control Register 5 */
+#define LPC_HICR5_ENFWH		(0x1 << 10)
+
+/*	AST_LPC_HICRB : 0x100	Host Interface Control Register B */
+#define LPC_HICRB_ILPC2AHB	(0x1 << 6)
+
+#endif
diff --git a/arch/arm/include/asm/arch-aspeed/regs-scu.h b/arch/arm/include/asm/arch-aspeed/regs-scu.h
index b714fa92341d..c9b91795d1aa 100644
--- a/arch/arm/include/asm/arch-aspeed/regs-scu.h
+++ b/arch/arm/include/asm/arch-aspeed/regs-scu.h
@@ -466,6 +466,7 @@
 #define SCU_MISC_JTAG__M_TO_PCIE_EN	(0x1 << 14)
 #define SCU_MISC_VUART_TO_CTRL		(0x1 << 13)
 #define SCU_MISC_DIV13_EN		(0x1 << 12)
+#define SCU_MISC_DEBUG_UART             (0x1 << 10)
 #define SCU_MISC_Y_CLK_INVERT		(0x1 << 11)
 #define SCU_MISC_OUT_DELAY		(0x1 << 9)
 #define SCU_MISC_PCI_TO_AHB_DIS		(0x1 << 8)
@@ -548,6 +549,7 @@
 /* AST_SCU_VGA_SCRATCH7			0x6c - VGA Scratch register */
 
 /* AST_SCU_HW_STRAP1			0x70 - hardware strapping register */
+#define SCU_HW_STRAP_LPC_DEC_SUPER_IO	(0x1 << 20)
 #ifdef AST_SOC_G5
 
 #define CLK_25M_IN			(0x1 << 23)
@@ -593,7 +595,6 @@
 
 #define SCU_HW_STRAP_GPIOE_PT_EN	(0x1 << 22)
 #define SCU_HW_STRAP_GPIOD_PT_EN	(0x1 << 21)
-#define SCU_HW_STRAP_LPC_DEC_SUPER_IO	(0x1 << 20)
 #define SCU_HW_STRAP_ACPI_DIS		(0x1 << 19)
 
 /* bit 23, 18 [1,0] */
@@ -940,6 +941,11 @@
 
 /* AST_SCU_UART24_REF			0x160 - Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
 /* AST_SCU_PCIE_CONFIG_SET		0x180 - PCI-E Configuration Setting Control Register */
+#define SCU_PCIE_CONFIG_SET_BMC_DMA     (0x1 << 14)
+#define SCU_PCIE_CONFIG_SET_BMC_MMIO    (0x1 << 9)
+#define SCU_PCIE_CONFIG_SET_BMC_EN      (0x1 << 8)
+#define SCU_PCIE_CONFIG_SET_VGA_MMIO    (0x1 << 1)
+
 /* AST_SCU_BMC_MMIO_DEC			0x184 - BMC MMIO Decode Setting Register */
 /* AST_SCU_DEC_AREA1			0x188 - 1st relocated controller decode area location */
 /* AST_SCU_DEC_AREA2			0x18C - 2nd relocated controller decode area location */
diff --git a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
index 2cc26d29aa9e..3b516ecccdde 100644
--- a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
+++ b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
@@ -18,6 +18,7 @@
  */
 #define AST_SDMC_PROTECT	0x00		/* protection key register */
 #define AST_SDMC_CONFIG		0x04		/* Configuration register */
+#define AST_SDMC_GFX_PROT	0x08		/* Graphics protection register */
 
 /*	AST_SDMC_PROTECT: 0x00  - protection key register */
 #define SDMC_PROTECT_UNLOCK			0xFC600309
@@ -29,4 +30,7 @@
 #define SDMC_CONFIG_CACHE_EN		(0x1 << 10)
 #define SDMC_CONFIG_EEC_EN		(0x1 << 7)
 
+/*	AST_SDMC_GFX_PROT : 0x08 - Graphics protection register */
+#define SDMC_GFX_PROT_XDMA	(0x1 << 16)
+
 #endif
diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
index 656495307b03..eda087fa5c17 100644
--- a/board/aspeed/ast-g4/ast-g4.c
+++ b/board/aspeed/ast-g4/ast-g4.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002 Ryan Chen
- * Copyright 2016 IBM Corporation
+ * Copyright 2016,2018 IBM Corporation
  *
  * SPDX-License-Identifier:     GPL-2.0+
  */
@@ -12,13 +12,44 @@
 #include <asm/arch/ast-sdmc.h>
 #include <asm/arch/ast_scu.h>
 #include <asm/arch/regs-ahbc.h>
+#include <asm/arch/regs-lpc.h>
 #include <asm/arch/regs-scu.h>
+#include <asm/arch/regs-sdmc.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
+	u32 val;
+
+	/* iLPC2AHB */
+	val = readl(AST_SCU_BASE + AST_SCU_HW_STRAP1);
+	val |= SCU_HW_STRAP_LPC_DEC_SUPER_IO;
+	writel(val, AST_SCU_BASE + AST_SCU_HW_STRAP1);
+
+	val = readl(AST_LPC_BASE + AST_LPC_HICRB);
+	val |= LPC_HICRB_ILPC2AHB;
+	writel(val, AST_LPC_BASE + AST_LPC_HICRB);
+
+	/* P2A, PCIe BMC */
+	val = readl(AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
+	val &= ~(SCU_PCIE_CONFIG_SET_BMC_DMA
+			| SCU_PCIE_CONFIG_SET_BMC_MMIO
+			| SCU_PCIE_CONFIG_SET_BMC_EN
+			| SCU_PCIE_CONFIG_SET_VGA_MMIO);
+	writel(val, AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
+
+	/* X-DMA */
+	val = readl(AST_SDMC_BASE + AST_SDMC_GFX_PROT);
+	val |= SDMC_GFX_PROT_XDMA;
+	writel(val, AST_SDMC_BASE + AST_SDMC_GFX_PROT);
+
+	/* LPC2AHB */
+	val = readl(AST_LPC_BASE + AST_LPC_HICR5);
+	val &= ~LPC_HICR5_ENFWH;
+	writel(val, AST_LPC_BASE + AST_LPC_HICR5);
+
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 	gd->flags = 0;
diff --git a/board/aspeed/ast-g5/ast-g5.c b/board/aspeed/ast-g5/ast-g5.c
index e67a4bf8b2b4..e8827524e3b2 100644
--- a/board/aspeed/ast-g5/ast-g5.c
+++ b/board/aspeed/ast-g5/ast-g5.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 IBM Corporation
+ * Copyright 2016,2018 IBM Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -12,12 +12,49 @@
 
 #include <asm/arch/ast_scu.h>
 #include <asm/arch/ast-sdmc.h>
+#include <asm/arch/regs-lpc.h>
+#include <asm/arch/regs-scu.h>
+#include <asm/arch/regs-sdmc.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
+	u32 val;
+
+	/* iLPC2AHB */
+	val = readl(AST_SCU_BASE + AST_SCU_HW_STRAP1);
+	val |= SCU_HW_STRAP_LPC_DEC_SUPER_IO;
+	writel(val, AST_SCU_BASE + AST_SCU_HW_STRAP1);
+
+	val = readl(AST_LPC_BASE + AST_LPC_HICRB);
+	val |= LPC_HICRB_ILPC2AHB;
+	writel(val, AST_LPC_BASE + AST_LPC_HICRB);
+
+	/* P2A, PCIe BMC */
+	val = readl(AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
+	val &= ~(SCU_PCIE_CONFIG_SET_BMC_DMA
+			| SCU_PCIE_CONFIG_SET_BMC_MMIO
+			| SCU_PCIE_CONFIG_SET_BMC_EN
+			| SCU_PCIE_CONFIG_SET_VGA_MMIO);
+	writel(val, AST_SCU_BASE + AST_SCU_PCIE_CONFIG_SET);
+
+	/* Debug UART */
+	val = readl(AST_SCU_BASE + AST_SCU_MISC1_CTRL);
+	val |= SCU_MISC_DEBUG_UART;
+	writel(val, AST_SCU_BASE + AST_SCU_MISC1_CTRL);
+
+	/* X-DMA */
+	val = readl(AST_SDMC_BASE + AST_SDMC_GFX_PROT);
+	val |= SDMC_GFX_PROT_XDMA;
+	writel(val, AST_SDMC_BASE + AST_SDMC_GFX_PROT);
+
+	/* LPC2AHB */
+	val = readl(AST_LPC_BASE + AST_LPC_HICR5);
+	val &= ~LPC_HICR5_ENFWH;
+	writel(val, AST_LPC_BASE + AST_LPC_HICR5);
+
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 	gd->flags = 0;
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH u-boot 3/4] arch-aspeed: Make AHBC and SDMC header guards unique
From: Andrew Jeffery @ 2018-07-23 14:58 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, openbmc
In-Reply-To: <20180723145840.17856-1-andrew@aj.id.au>

Otherwise we get mysterious missing symbols if we include both those and
the ast-{ahbc,sdmc}.h files.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 arch/arm/include/asm/arch-aspeed/regs-ahbc.h | 4 ++--
 arch/arm/include/asm/arch-aspeed/regs-sdmc.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/arch-aspeed/regs-ahbc.h b/arch/arm/include/asm/arch-aspeed/regs-ahbc.h
index 66e29839e8f1..4f403c45d3a5 100644
--- a/arch/arm/include/asm/arch-aspeed/regs-ahbc.h
+++ b/arch/arm/include/asm/arch-aspeed/regs-ahbc.h
@@ -10,8 +10,8 @@
  *    1. 2012/12/29 Ryan Chen Create
  *
  ******************************************************************************/
-#ifndef __AST_AHBC_H
-#define __AST_AHBC_H
+#ifndef __AST_REGS_AHBC_H
+#define __AST_REGS_AHBC_H
 
 #include <asm/arch/aspeed.h>
 
diff --git a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
index 2861f3b2c947..2cc26d29aa9e 100644
--- a/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
+++ b/arch/arm/include/asm/arch-aspeed/regs-sdmc.h
@@ -10,8 +10,8 @@
  *    1. 2012/12/29 Ryan Chen Create
  *
  ******************************************************************************/
-#ifndef __AST_SDMC_H
-#define __AST_SDMC_H
+#ifndef __AST_REGS_SDMC_H
+#define __AST_REGS_SDMC_H
 
 /*
  *  Register for SDMC
-- 
2.17.1

^ permalink raw reply related

* [PATCH u-boot 2/4] ast-g4: Fix typo in board_init() comment
From: Andrew Jeffery @ 2018-07-23 14:58 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, openbmc
In-Reply-To: <20180723145840.17856-1-andrew@aj.id.au>

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 board/aspeed/ast-g4/ast-g4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c
index cc26a78529bc..656495307b03 100644
--- a/board/aspeed/ast-g4/ast-g4.c
+++ b/board/aspeed/ast-g4/ast-g4.c
@@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-	/* adress of boot parameters */
+	/* address of boot parameters */
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 	gd->flags = 0;
 	return 0;
-- 
2.17.1

^ permalink raw reply related

* [PATCH u-boot 1/4] checkpatch: Fix unescaped brace warning
From: Andrew Jeffery @ 2018-07-23 14:58 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, openbmc
In-Reply-To: <20180723145840.17856-1-andrew@aj.id.au>

Running checkpatch using Ubuntu 18.04's packaged perl
(5.26.1-6ubuntu0.1) gave the following output:

    Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/^(\+.*(?:do|\))){ <-- HERE / at ./scripts/checkpatch.pl line 3267

Escape the brace to avoid the warning.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 24831b3166e2..d38369638c6a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3264,7 +3264,7 @@ sub process {
 			if (ERROR("SPACING",
 				  "space required before the open brace '{'\n" . $herecurr) &&
 			    $fix) {
-				$fixed[$linenr - 1] =~ s/^(\+.*(?:do|\))){/$1 {/;
+				$fixed[$linenr - 1] =~ s/^(\+.*(?:do|\)))\{/$1 {/;
 			}
 		}
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH u-boot 0/4] Cleanups and disable unnecessary features
From: Andrew Jeffery @ 2018-07-23 14:58 UTC (permalink / raw)
  To: joel; +Cc: Andrew Jeffery, openbmc

Hello,

This series is a mishmash of cleanups with an added dash of disabling value-add
features that we don't require during normal BMC operation. It has been tested
on OpenPOWER Palmetto (AST2400) and Witherspoon (AST2500) platforms.

Please review!

Cheers,

Andrew

Andrew Jeffery (4):
  checkpatch: Fix unescaped brace warning
  ast-g4: Fix typo in board_init() comment
  arch-aspeed: Make AHBC and SDMC header guards unique
  aspeed: Disable unnecessary features

 arch/arm/include/asm/arch-aspeed/regs-ahbc.h |  4 +-
 arch/arm/include/asm/arch-aspeed/regs-lpc.h  | 29 +++++++++++++++
 arch/arm/include/asm/arch-aspeed/regs-scu.h  |  8 +++-
 arch/arm/include/asm/arch-aspeed/regs-sdmc.h |  8 +++-
 board/aspeed/ast-g4/ast-g4.c                 | 35 +++++++++++++++++-
 board/aspeed/ast-g5/ast-g5.c                 | 39 +++++++++++++++++++-
 scripts/checkpatch.pl                        |  2 +-
 7 files changed, 116 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-aspeed/regs-lpc.h

-- 
2.17.1

^ permalink raw reply

* Re: [Qemu-arm] [PATCH 0/6] accel/tcg: Support execution from MMIO and small MMU regions
From: Cédric Le Goater @ 2018-07-23 14:57 UTC (permalink / raw)
  To: Peter Maydell, qemu-arm, qemu-devel
  Cc: patches, KONRAD Frederic, Emilio G . Cota, Paolo Bonzini,
	Richard Henderson
In-Reply-To: <20180710160013.26559-1-peter.maydell@linaro.org>

On 07/10/2018 06:00 PM, Peter Maydell wrote:
> This series adds support to TCG for executing from MMIO regions
> and small MMU regions. The basic principle is that if get_page_addr_code()
> finds that the region is not backed by a full page of RAM then it
> returns -1, and tb_gen_code() then generates a non-cached TB
> containing a single instruction. Execution from these regions
> thus performs the instruction fetch every time, ensuring that we
> get the read-from-MMIO and check-small-MMU-region permissions
> checks right.
> 
> This means that the code path for "generate bus fault for failing
> to load an instruction" no longer goes through get_page_addr_code(),
> but instead via each target's translate code and its calls to
> the cpu_ld*_code() or similar functions. Patch 1 makes sure we
> can distinguish insn fetches from data loads when generating the
> bus fault exceptions. (Aside: I have assumed that all cpu_ld*_code()
> loads should trigger iside faults rather than dside. Hopefully this
> is true...)
> 
> Patches 2 and 3 make trivial fixes to various callers of
> get_page_addr_code(); patch 4 does the work of generating our
> single-insn TBs. Patch 5 can then remove all the code that
> (mis)handles MMIO regions from get_page_addr_code(). Finally
> patch 6 drops the target/arm workarounds for not having support
> for executing from small MPU regions.
> 
> Note for the Xilinx folks: this patchset makes the mmio-exec
> testcase for running from the SPI flash pass. Cedric: you might
> like to test the aspeed image you had that relies on execution
> from an MMIO region too.

I have added a memory region alias at 0x0 on the memory region where
the first flash device is mapped and all aspeed machines, palmetto, 
romulus, witherspoon booted fine. 

More or less 4MB of data access is generated and the slowdown is hardly 
noticeable, around one second on a laptop.

I wonder if I should add a bool option to the machine to activate
or not the feature ?

Thanks,

C. 

> The diffstat is pretty satisfying for a patchset that adds
> a feature, but it actually undersells it: this code renders the
> hw/misc/mmio_interface.c and the mmio_ptr related code in memory.c
> and the xilinx-spips device all obsolete, so there are another
> couple of hundred lines of code to be deleted there. I opted not
> to include that in this patchset, for ease of review.
> 
> NB: I tested this with icount, but there are potentially
> some weird things that could happen with interactions between
> icount's io-recompile and execution from an MMIO device
> that returns different instructions each time it's read.
> 
> thanks
> -- PMM
> 
> 
> Peter Maydell (6):
>   accel/tcg: Pass read access type through to io_readx()
>   accel/tcg: Handle get_page_addr_code() returning -1 in hashtable
>     lookups
>   accel/tcg: Handle get_page_addr_code() returning -1 in
>     tb_check_watchpoint()
>   accel/tcg: tb_gen_code(): Create single-insn TB for execution from
>     non-RAM
>   accel/tcg: Return -1 for execution from MMIO regions in
>     get_page_addr_code()
>   target/arm: Allow execution from small regions
> 
>  accel/tcg/softmmu_template.h |  11 ++--
>  include/qom/cpu.h            |   6 +++
>  accel/tcg/cpu-exec.c         |   3 ++
>  accel/tcg/cputlb.c           | 100 +++++------------------------------
>  accel/tcg/translate-all.c    |  23 +++++++-
>  memory.c                     |   3 +-
>  target/arm/helper.c          |  23 --------
>  7 files changed, 52 insertions(+), 117 deletions(-)
> 


^ permalink raw reply

* Re: [Qemu-devel] [PATCH 0/6] accel/tcg: Support execution from MMIO and small MMU regions
From: Cédric Le Goater @ 2018-07-23 14:57 UTC (permalink / raw)
  To: Peter Maydell, qemu-arm, qemu-devel
  Cc: patches, Richard Henderson, Emilio G . Cota, Paolo Bonzini,
	Edgar E. Iglesias, KONRAD Frederic
In-Reply-To: <20180710160013.26559-1-peter.maydell@linaro.org>

On 07/10/2018 06:00 PM, Peter Maydell wrote:
> This series adds support to TCG for executing from MMIO regions
> and small MMU regions. The basic principle is that if get_page_addr_code()
> finds that the region is not backed by a full page of RAM then it
> returns -1, and tb_gen_code() then generates a non-cached TB
> containing a single instruction. Execution from these regions
> thus performs the instruction fetch every time, ensuring that we
> get the read-from-MMIO and check-small-MMU-region permissions
> checks right.
> 
> This means that the code path for "generate bus fault for failing
> to load an instruction" no longer goes through get_page_addr_code(),
> but instead via each target's translate code and its calls to
> the cpu_ld*_code() or similar functions. Patch 1 makes sure we
> can distinguish insn fetches from data loads when generating the
> bus fault exceptions. (Aside: I have assumed that all cpu_ld*_code()
> loads should trigger iside faults rather than dside. Hopefully this
> is true...)
> 
> Patches 2 and 3 make trivial fixes to various callers of
> get_page_addr_code(); patch 4 does the work of generating our
> single-insn TBs. Patch 5 can then remove all the code that
> (mis)handles MMIO regions from get_page_addr_code(). Finally
> patch 6 drops the target/arm workarounds for not having support
> for executing from small MPU regions.
> 
> Note for the Xilinx folks: this patchset makes the mmio-exec
> testcase for running from the SPI flash pass. Cedric: you might
> like to test the aspeed image you had that relies on execution
> from an MMIO region too.

I have added a memory region alias at 0x0 on the memory region where
the first flash device is mapped and all aspeed machines, palmetto, 
romulus, witherspoon booted fine. 

More or less 4MB of data access is generated and the slowdown is hardly 
noticeable, around one second on a laptop.

I wonder if I should add a bool option to the machine to activate
or not the feature ?

Thanks,

C. 

> The diffstat is pretty satisfying for a patchset that adds
> a feature, but it actually undersells it: this code renders the
> hw/misc/mmio_interface.c and the mmio_ptr related code in memory.c
> and the xilinx-spips device all obsolete, so there are another
> couple of hundred lines of code to be deleted there. I opted not
> to include that in this patchset, for ease of review.
> 
> NB: I tested this with icount, but there are potentially
> some weird things that could happen with interactions between
> icount's io-recompile and execution from an MMIO device
> that returns different instructions each time it's read.
> 
> thanks
> -- PMM
> 
> 
> Peter Maydell (6):
>   accel/tcg: Pass read access type through to io_readx()
>   accel/tcg: Handle get_page_addr_code() returning -1 in hashtable
>     lookups
>   accel/tcg: Handle get_page_addr_code() returning -1 in
>     tb_check_watchpoint()
>   accel/tcg: tb_gen_code(): Create single-insn TB for execution from
>     non-RAM
>   accel/tcg: Return -1 for execution from MMIO regions in
>     get_page_addr_code()
>   target/arm: Allow execution from small regions
> 
>  accel/tcg/softmmu_template.h |  11 ++--
>  include/qom/cpu.h            |   6 +++
>  accel/tcg/cpu-exec.c         |   3 ++
>  accel/tcg/cputlb.c           | 100 +++++------------------------------
>  accel/tcg/translate-all.c    |  23 +++++++-
>  memory.c                     |   3 +-
>  target/arm/helper.c          |  23 --------
>  7 files changed, 52 insertions(+), 117 deletions(-)
> 

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.