diff options
author | Whi copybara merger <whitechapel-automerger@google.com> | 2023-03-28 21:36:02 +0000 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2023-04-05 18:13:04 +0000 |
commit | b6fd94b0f15caef90cf5efb822122e24916bd1bd (patch) | |
tree | bd2081a462bbbac5c98c4cefd6a06a96d9b6f188 | |
parent | 9cbd6821b529a006762748c6feff21798240cffe (diff) | |
download | janeiro-b6fd94b0f15caef90cf5efb822122e24916bd1bd.tar.gz |
[Copybara Auto Merge] Merge branch pro into partner-androidandroid-u-beta-2_r0.4android-u-beta-2_r0.3android-u-beta-2_r0.2
edgetpu: KCI accept out-of-order responses
Bug: 274574929
edgetpu: Use scmversion over GIT_REPO_TAG
Bug: 274893782
GitOrigin-RevId: b649f62d1b52ccf71b7ba954056328564bc4d92a
Change-Id: I2dcf9f0107b279dfc3d586eef9a3003dfc7cb8f5
-rw-r--r-- | drivers/edgetpu/Kbuild | 10 | ||||
-rw-r--r-- | drivers/edgetpu/Makefile | 10 | ||||
-rw-r--r-- | drivers/edgetpu/edgetpu-fs.c | 2 | ||||
-rw-r--r-- | drivers/edgetpu/edgetpu-kci.c | 10 | ||||
-rw-r--r-- | drivers/edgetpu/edgetpu-mobile-platform.c | 14 |
5 files changed, 27 insertions, 19 deletions
diff --git a/drivers/edgetpu/Kbuild b/drivers/edgetpu/Kbuild index 39003e0..52c5693 100644 --- a/drivers/edgetpu/Kbuild +++ b/drivers/edgetpu/Kbuild @@ -3,11 +3,11 @@ obj-m += janeiro.o CURRENT_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) ccflags-y += -DCONFIG_EDGETPU_TELEMETRY_TRACE=1 -I$(CURRENT_DIR)/include GIT_PATH=$(CURRENT_DIR)/../../ -ifeq ($(shell git --git-dir=$(GIT_PATH)/.git rev-parse --is-inside-work-tree),true) - GIT_REPO_STATE=$(shell (git --git-dir=$(GIT_PATH)/.git --work-tree=$(GIT_PATH) status --porcelain | grep -q .) && echo -dirty) - ccflags-y += -DGIT_REPO_TAG=\"$(shell git --git-dir=$(GIT_PATH)/.git rev-parse --short HEAD)$(GIT_REPO_STATE)\" -else - ccflags-y += -DGIT_REPO_TAG=\"Not\ a\ git\ repository\" +GIT_BIN=/usr/bin/git +GIT=$(GIT_BIN) -C $(GIT_PATH) +ifeq ($(shell $(GIT) rev-parse --is-inside-work-tree),true) + GIT_REPO_STATE=$(shell ($(GIT) status --porcelain | grep -q .) && echo -dirty) + ccflags-y += -DGIT_REPO_TAG=\"$(shell $(GIT) rev-parse --short HEAD)$(GIT_REPO_STATE)-kbuild\" endif edgetpu-objs := edgetpu-mailbox.o edgetpu-telemetry.o edgetpu-mapping.o edgetpu-dmabuf.o edgetpu-async.o edgetpu-iremap-pool.o edgetpu-sw-watchdog.o edgetpu-firmware.o edgetpu-firmware-util.o edgetpu-domain-pool.o diff --git a/drivers/edgetpu/Makefile b/drivers/edgetpu/Makefile index 4df0c7e..b2a740e 100644 --- a/drivers/edgetpu/Makefile +++ b/drivers/edgetpu/Makefile @@ -6,11 +6,11 @@ obj-$(CONFIG_JANEIRO) += janeiro.o GIT_PATH=$(srctree) -ifeq ($(shell git --git-dir=$(GIT_PATH)/.git rev-parse --is-inside-work-tree),true) - GIT_REPO_STATE=$(shell (git --git-dir=$(GIT_PATH)/.git --work-tree=$(GIT_PATH) status --porcelain | grep -q .) && echo -dirty) - ccflags-y += -DGIT_REPO_TAG=\"$(shell git --git-dir=$(GIT_PATH)/.git rev-parse --short HEAD)$(GIT_REPO_STATE)\" -else - ccflags-y += -DGIT_REPO_TAG=\"Not\ a\ git\ repository\" +GIT_BIN=/usr/bin/git +GIT=$(GIT_BIN) -C $(GIT_PATH) +ifeq ($(shell $(GIT) rev-parse --is-inside-work-tree),true) + GIT_REPO_STATE=$(shell ($(GIT) status --porcelain | grep -q .) && echo -dirty) + ccflags-y += -DGIT_REPO_TAG=\"$(shell $(GIT) rev-parse --short HEAD)$(GIT_REPO_STATE)-makefile\" endif edgetpu-objs := edgetpu-async.o edgetpu-dmabuf.o edgetpu-iremap-pool.o \ diff --git a/drivers/edgetpu/edgetpu-fs.c b/drivers/edgetpu/edgetpu-fs.c index 854c14c..bef8d35 100644 --- a/drivers/edgetpu/edgetpu-fs.c +++ b/drivers/edgetpu/edgetpu-fs.c @@ -1360,4 +1360,6 @@ struct dentry *edgetpu_fs_debugfs_dir(void) MODULE_DESCRIPTION("Google EdgeTPU file operations"); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL v2"); +#ifdef GIT_REPO_TAG MODULE_INFO(gitinfo, GIT_REPO_TAG); +#endif diff --git a/drivers/edgetpu/edgetpu-kci.c b/drivers/edgetpu/edgetpu-kci.c index fd52c3c..52eff65 100644 --- a/drivers/edgetpu/edgetpu-kci.c +++ b/drivers/edgetpu/edgetpu-kci.c @@ -201,10 +201,7 @@ static void edgetpu_reverse_kci_init(struct edgetpu_reverse_kci *rkci) * 2. #seq == @resp->seq: * - Copy @resp, pop the head and we're done. * 3. #seq < @resp->seq: - * - Should not happen, this implies the sequence number of either entries in - * wait_list or responses are out-of-order, or remote didn't respond to a - * command. In this case, the status of response will be set to - * KCI_STATUS_NO_RESPONSE. + * - Probable race with another context also processing KCI responses, ignore. * - Pop until case 1. or 2. */ static void edgetpu_kci_consume_wait_list( @@ -225,10 +222,7 @@ static void edgetpu_kci_consume_wait_list( kfree(cur); break; } - /* #seq < @resp->seq */ - cur->resp->status = KCI_STATUS_NO_RESPONSE; - list_del(&cur->list); - kfree(cur); + /* #seq < @resp->seq, probable race with another consumer, let it handle. */ } spin_unlock_irqrestore(&kci->wait_list_lock, flags); diff --git a/drivers/edgetpu/edgetpu-mobile-platform.c b/drivers/edgetpu/edgetpu-mobile-platform.c index 96fe245..194c741 100644 --- a/drivers/edgetpu/edgetpu-mobile-platform.c +++ b/drivers/edgetpu/edgetpu-mobile-platform.c @@ -327,6 +327,17 @@ edgetpu_mobile_platform_set_fw_ctx_memory(struct edgetpu_mobile_platform_dev *et return 0; } +static inline const char *get_driver_commit(void) +{ +#if IS_ENABLED(CONFIG_MODULE_SCMVERSION) + return THIS_MODULE->scmversion; +#elif defined(GIT_REPO_TAG) + return GIT_REPO_TAG; +#else + return "Unknown"; +#endif +} + static int edgetpu_mobile_platform_probe(struct platform_device *pdev, struct edgetpu_mobile_platform_dev *etmdev) { @@ -452,7 +463,8 @@ static int edgetpu_mobile_platform_probe(struct platform_device *pdev, } } - dev_info(dev, "%s edgetpu initialized. Build: %s", etdev->dev_name, GIT_REPO_TAG); + dev_info(dev, "%s edgetpu initialized. Build: %s", etdev->dev_name, get_driver_commit()); + /* Turn the device off unless a client request is already received. */ edgetpu_pm_shutdown(etdev, false); |